Skip to content

Commit

Permalink
Merge pull request #294 from scylladb/make_mutate_simplier
Browse files Browse the repository at this point in the history
fix(cqlStore): make mutate simplier
  • Loading branch information
dkropachev authored May 2, 2023
2 parents 6eea6ba + 5404de3 commit 6945ca7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions store/cqlstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,19 @@ func (cs *cqlStore) mutate(ctx context.Context, builder qb.Builder, ts time.Time
for i = 0; i < cs.maxRetriesMutate; i++ {
err = cs.doMutate(ctx, builder, ts, values...)
if err == nil {
break
cs.ops.WithLabelValues(cs.system, opType(builder)).Inc()
return nil
}
select {
case <-ctx.Done():
return ctx.Err()
case <-time.After(cs.maxRetriesMutateSleep):
}
}
if err != nil {
if w := cs.logger.Check(zap.InfoLevel, "failed to apply mutation"); w != nil {
w.Write(zap.Int("attempts", i), zap.Error(err))
}
return
if w := cs.logger.Check(zap.InfoLevel, "failed to apply mutation"); w != nil {
w.Write(zap.Int("attempts", i), zap.Error(err))
}

cs.ops.WithLabelValues(cs.system, opType(builder)).Inc()
return
return err
}

func (cs *cqlStore) doMutate(ctx context.Context, builder qb.Builder, ts time.Time, values ...interface{}) error {
Expand Down

0 comments on commit 6945ca7

Please sign in to comment.