mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Remove context.TODO() (#43409)
* Remove context.TODO() from services * Fix live test * Remove context.TODO
This commit is contained in:
@@ -86,19 +86,19 @@ func newRedisStorage(opts *setting.RemoteCacheOptions) (*redisStorage, error) {
|
||||
}
|
||||
|
||||
// Set sets value to given key in session.
|
||||
func (s *redisStorage) Set(key string, val interface{}, expires time.Duration) error {
|
||||
func (s *redisStorage) Set(ctx context.Context, key string, val interface{}, expires time.Duration) error {
|
||||
item := &cachedItem{Val: val}
|
||||
value, err := encodeGob(item)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
status := s.c.Set(context.TODO(), key, string(value), expires)
|
||||
status := s.c.Set(ctx, key, string(value), expires)
|
||||
return status.Err()
|
||||
}
|
||||
|
||||
// Get gets value by given key in session.
|
||||
func (s *redisStorage) Get(key string) (interface{}, error) {
|
||||
v := s.c.Get(context.TODO(), key)
|
||||
func (s *redisStorage) Get(ctx context.Context, key string) (interface{}, error) {
|
||||
v := s.c.Get(ctx, key)
|
||||
|
||||
item := &cachedItem{}
|
||||
err := decodeGob([]byte(v.Val()), item)
|
||||
@@ -113,7 +113,7 @@ func (s *redisStorage) Get(key string) (interface{}, error) {
|
||||
}
|
||||
|
||||
// Delete delete a key from session.
|
||||
func (s *redisStorage) Delete(key string) error {
|
||||
cmd := s.c.Del(context.TODO(), key)
|
||||
func (s *redisStorage) Delete(ctx context.Context, key string) error {
|
||||
cmd := s.c.Del(ctx, key)
|
||||
return cmd.Err()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user