Skip to content

Commit

Permalink
add redis prefix to communication channel (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
gipsh committed Aug 22, 2023
1 parent 0741ef7 commit 3fa1804
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion common/client/cache/notional/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func NewNotionalCache(ctx context.Context, redisClient *redis.Client, prefix str
return &NotionalCache{
client: redisClient,
pubSub: pubsub,
channel: channel,
channel: formatChannel(prefix, channel),
notionalMap: sync.Map{},
prefix: prefix,
logger: log}, nil
Expand Down Expand Up @@ -180,3 +180,10 @@ func (c *NotionalCache) renderKey(key string) string {
func (c *NotionalCache) renderRegExp() string {
return "*" + c.renderKey(wormscanNotionalCacheKeyRegex)
}

func formatChannel(prefix string, channel string) string {
if prefix != "" {
return fmt.Sprintf("%s:%s", prefix, channel)
}
return channel
}
2 changes: 1 addition & 1 deletion jobs/jobs/notional/notional.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewNotionalJob(api *coingecko.CoingeckoAPI, cacheClient *redis.Client, cach
coingeckoAPI: api,
cacheClient: cacheClient,
cachePrefix: cachePrefix,
cacheChannel: cacheChannel,
cacheChannel: formatChannel(cachePrefix, cacheChannel),
p2pNetwork: p2pNetwork,
logger: logger,
}
Expand Down

0 comments on commit 3fa1804

Please sign in to comment.