Skip to content

Commit

Permalink
style(redis): Fix lll linter
Browse files Browse the repository at this point in the history
  • Loading branch information
novln committed Oct 26, 2020
1 parent afd00a9 commit a682e90
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions drivers/store/redis/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ func peekValue(ctx context.Context, rtx *libredis.Tx, key string) (int64, time.D
}

// doSetValue will execute setValue with a retry mecanism (optimistic locking) until store.MaxRetry is reached.
func (store *Store) doSetValue(ctx context.Context, rtx *libredis.Tx, key string, expiration time.Duration) (bool, error) {
func (store *Store) doSetValue(ctx context.Context, rtx *libredis.Tx,
key string, expiration time.Duration) (bool, error) {

for i := 0; i < store.MaxRetry; i++ {
created, err := setValue(ctx, rtx, key, expiration)
if err == nil {
Expand All @@ -218,6 +220,7 @@ func setValue(ctx context.Context, rtx *libredis.Tx, key string, expiration time
// doUpdateValue will execute setValue with a retry mecanism (optimistic locking) until store.MaxRetry is reached.
func (store *Store) doUpdateValue(ctx context.Context, rtx *libredis.Tx, key string,
expiration time.Duration) (int64, time.Duration, error) {

for i := 0; i < store.MaxRetry; i++ {
count, ttl, err := updateValue(ctx, rtx, key, expiration)
if err == nil {
Expand All @@ -233,7 +236,9 @@ func (store *Store) doUpdateValue(ctx context.Context, rtx *libredis.Tx, key str
}

// updateValue will try to increment the counter identified by given key.
func updateValue(ctx context.Context, rtx *libredis.Tx, key string, expiration time.Duration) (int64, time.Duration, error) {
func updateValue(ctx context.Context, rtx *libredis.Tx,
key string, expiration time.Duration) (int64, time.Duration, error) {

pipe := rtx.TxPipeline()
value := pipe.Incr(ctx, key)
expire := pipe.PTTL(ctx, key)
Expand Down

0 comments on commit a682e90

Please sign in to comment.