Chore: Remove context.TODO (#43458)
* Remove context.TODO() from services * Fix live test
This commit is contained in:
@@ -42,9 +42,9 @@ func (c *RedisFrameCache) GetActiveChannels(orgID int64) (map[string]json.RawMes
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (c *RedisFrameCache) GetFrame(orgID int64, channel string) (json.RawMessage, bool, error) {
|
||||
func (c *RedisFrameCache) GetFrame(ctx context.Context, orgID int64, channel string) (json.RawMessage, bool, error) {
|
||||
key := getCacheKey(orgchannel.PrependOrgID(orgID, channel))
|
||||
cmd := c.redisClient.HGetAll(context.TODO(), key)
|
||||
cmd := c.redisClient.HGetAll(ctx, key)
|
||||
result, err := cmd.Result()
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
@@ -59,7 +59,7 @@ const (
|
||||
frameCacheTTL = 7 * 24 * time.Hour
|
||||
)
|
||||
|
||||
func (c *RedisFrameCache) Update(orgID int64, channel string, jsonFrame data.FrameJSONCache) (bool, error) {
|
||||
func (c *RedisFrameCache) Update(ctx context.Context, orgID int64, channel string, jsonFrame data.FrameJSONCache) (bool, error) {
|
||||
c.mu.Lock()
|
||||
if _, ok := c.frames[orgID]; !ok {
|
||||
c.frames[orgID] = map[string]data.FrameJSONCache{}
|
||||
@@ -74,8 +74,6 @@ func (c *RedisFrameCache) Update(orgID int64, channel string, jsonFrame data.Fra
|
||||
pipe := c.redisClient.TxPipeline()
|
||||
defer func() { _ = pipe.Close() }()
|
||||
|
||||
ctx := context.TODO()
|
||||
|
||||
pipe.HGetAll(ctx, key)
|
||||
pipe.HMSet(ctx, key, map[string]string{
|
||||
"schema": stringSchema,
|
||||
|
||||
Reference in New Issue
Block a user