Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
tbuchaillot committed Jan 31, 2024
1 parent cc755c0 commit 088119d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion persistent/model/object_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ func TestUnmarshalJSON(t *testing.T) {

var id2 ObjectID
err = id2.UnmarshalJSON(idBytes)

if err != nil {
t.Fatal(err)
}
Expand Down
8 changes: 5 additions & 3 deletions temporal/internal/driver/redisv9/keyvalue.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ func (r *RedisV9) DeleteScanMatch(ctx context.Context, pattern string) (int64, e
case *redis.Client:
var err error
totalDeleted, err = r.deleteScanMatchSingleNode(ctx, client, pattern)

if err != nil {
if errors.Is(err, redis.ErrClosed) {
return totalDeleted, temperr.ClosedConnection
Expand All @@ -218,7 +217,6 @@ func (r *RedisV9) deleteScanMatchSingleNode(ctx context.Context, client redis.Cm

var keys []string
keys, _, err = client.Scan(ctx, cursor, pattern, 0).Result()

if err != nil {
return int64(deleted), err
}
Expand Down Expand Up @@ -486,5 +484,9 @@ func (r *RedisV9) SetIfNotExist(ctx context.Context, key, value string, expirati
}

res := r.client.SetNX(ctx, key, value, expiration)
return res.Val(), res.Err()
if res.Err() != nil {
return false, res.Err()
}

return res.Val(), nil
}
3 changes: 2 additions & 1 deletion temporal/model/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ type KeyValue interface {
Get(ctx context.Context, key string) (value string, err error)
// Set sets the string value of a key
Set(ctx context.Context, key, value string, ttl time.Duration) error
// SetIfNotExist sets the string value of a key if the key does not exist. Returns true if the key was set, false otherwise.
// SetIfNotExist sets the string value of a key if the key does not exist.
// Returns true if the key was set, false otherwise.
SetIfNotExist(ctx context.Context, key, value string, expiration time.Duration) (bool, error)
// Delete removes the specified keys
Delete(ctx context.Context, key string) error
Expand Down

0 comments on commit 088119d

Please sign in to comment.