diff --git a/.golangci.yml b/.golangci.yml index 223cad7..f287078 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -3,23 +3,11 @@ run: concurrency: 4 timeout: 5m tests: true - # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ - skip-dirs-use-default: true modules-download-mode: readonly allow-parallel-runners: false - go: '1.19' # output configuration options output: - # Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions - # - # Multiple can be specified by separating them by comma, output can be provided - # for each of them by separating format name and path by colon symbol. - # Output path can be either `stdout`, `stderr` or path to the file to write to. - # Example: "checkstyle:report.json,colored-line-number" - # - # Default: colored-line-number - format: colored-line-number print-issued-lines: true print-linter-name: true uniq-by-line: true diff --git a/cart/redis/infrastructure/redisStorage.go b/cart/redis/infrastructure/redisStorage.go index 24d04bb..850bd47 100644 --- a/cart/redis/infrastructure/redisStorage.go +++ b/cart/redis/infrastructure/redisStorage.go @@ -110,7 +110,7 @@ func (r *RedisStorage) Inject( // GetCart fetches a cart from redis and deserializes it func (r *RedisStorage) GetCart(ctx context.Context, id string) (*cartDomain.Cart, error) { - cmd := r.client.Get(ctx, r.keyPrefix+id) + cmd := r.client.Get(context.WithoutCancel(ctx), r.keyPrefix+id) if err := cmd.Err(); err != nil { return nil, fmt.Errorf("could not get cart: %w", err) } @@ -130,7 +130,7 @@ func (r *RedisStorage) GetCart(ctx context.Context, id string) (*cartDomain.Cart // HasCart checks if the cart id exists as a key in redis func (r *RedisStorage) HasCart(ctx context.Context, id string) bool { - cmd := r.client.Exists(ctx, r.keyPrefix+id) + cmd := r.client.Exists(context.WithoutCancel(ctx), r.keyPrefix+id) if err := cmd.Err(); err != nil { r.logger.WithContext(ctx).WithField(flamingo.LogKeyModule, "RedisStorage").Warn(fmt.Errorf("HasCart: couldn't check redis exists: %w returned value: %q", err, cmd.Val())) @@ -151,7 +151,7 @@ func (r *RedisStorage) StoreCart(ctx context.Context, cart *cartDomain.Cart) err return fmt.Errorf("could not store cart: %w", err) } - err = r.client.Set(ctx, r.keyPrefix+cart.ID, b, r.ttl(cart)).Err() + err = r.client.Set(context.WithoutCancel(ctx), r.keyPrefix+cart.ID, b, r.ttl(cart)).Err() if err != nil { return fmt.Errorf("could not store cart: %w", err) } @@ -174,7 +174,7 @@ func (r *RedisStorage) RemoveCart(ctx context.Context, cart *cartDomain.Cart) er return ErrCartIsNil } - err := r.client.Del(ctx, r.keyPrefix+cart.ID).Err() + err := r.client.Del(context.WithoutCancel(ctx), r.keyPrefix+cart.ID).Err() if err != nil { return fmt.Errorf("could not remove cart: %w", err) }