Skip to content

Commit

Permalink
fix: use tx
Browse files Browse the repository at this point in the history
  • Loading branch information
acha-bill committed Jul 10, 2023
1 parent 6493036 commit 65b17bf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/storer/reserve.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ func (db *DB) evictionWorker(ctx context.Context) {
"total_evicted", evicted,
)

err = db.Execute(ctx, func(st internal.Storage) error {
return st.IndexStore().Delete(&expiredBatchItem{BatchID: batchID})
err = db.Execute(ctx, func(tx internal.Storage) error {
return tx.IndexStore().Delete(&expiredBatchItem{BatchID: batchID})
})
if err != nil {
db.logger.Error(err, "delete expired batch", "batch", hex.EncodeToString(batchID))
Expand Down Expand Up @@ -324,7 +324,7 @@ func (db *DB) EvictBatch(ctx context.Context, batchID []byte) error {
}

err := db.Execute(ctx, func(tx internal.Storage) error {
return db.repo.IndexStore().Put(&expiredBatchItem{BatchID: batchID})
return tx.IndexStore().Put(&expiredBatchItem{BatchID: batchID})
})
if err != nil {
return fmt.Errorf("save expired batch: %w", err)
Expand Down

0 comments on commit 65b17bf

Please sign in to comment.