Skip to content

Commit 632fae8

Browse files
aledbfroboquat
authored andcommitted
Remove Redis ttl keys
1 parent 8128261 commit 632fae8

File tree

1 file changed

+4
-21
lines changed
  • components/registry-facade/pkg/registry

1 file changed

+4
-21
lines changed

components/registry-facade/pkg/registry/cache.go

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ func (w *redisBlobWriter) Commit(ctx context.Context, size int64, expected diges
251251
var (
252252
kContent = fmt.Sprintf("cnt.%s", w.digest)
253253
kInfo = fmt.Sprintf("nfo.%s", w.digest)
254-
ttl = 48 * time.Hour
255254
)
256255

257256
existingKeys, err := w.client.Exists(ctx, kContent, kInfo).Result()
@@ -263,30 +262,14 @@ func (w *redisBlobWriter) Commit(ctx context.Context, size int64, expected diges
263262
return nil
264263
}
265264

266-
pipe := w.client.TxPipeline()
267-
defer pipe.Close()
268-
269-
err = pipe.SetEX(ctx, kContent, w.buf.String(), ttl).Err()
270-
if err != nil {
271-
return err
272-
}
273-
274-
err = pipe.SetEX(ctx, kInfo, string(rnfo), ttl).Err()
265+
err = w.client.MSet(ctx, map[string]interface{}{
266+
kContent: w.buf.String(),
267+
kInfo: string(rnfo),
268+
}).Err()
275269
if err != nil {
276270
return err
277271
}
278272

279-
errs, err := pipe.Exec(ctx)
280-
if err != nil {
281-
// in case of errors, there is no details besides the abort of the transaction:
282-
// EXECABORT Transaction discarded because of previous errors.
283-
if len(errs) > 0 {
284-
log.WithField("errors", errs).WithField("kContent", kContent).WithField("kInfo", kInfo).Error("unexpected error during redis commit")
285-
}
286-
287-
return err
288-
}
289-
290273
return nil
291274
}
292275

0 commit comments

Comments
 (0)