Skip to content

Commit 772c0dc

Browse files
committed
well, badger nor badger-ds adapter do not handle contexts...
1 parent 8ba9e62 commit 772c0dc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

store/store.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,11 @@ func (s *Store[H]) deleteRange(ctx context.Context, from, to uint64) (err error)
505505

506506
// delete deletes a single header from the store, its caches and indexies, notifying any registered onDelete handlers.
507507
func (s *Store[H]) delete(ctx context.Context, height uint64, batch datastore.Batch, onDelete []func(ctx context.Context, height uint64) error) error {
508+
// some of the methods may not handle context cancellation properly
509+
if ctx.Err() != nil {
510+
return ctx.Err()
511+
}
512+
508513
hash, err := s.heightIndex.HashByHeight(ctx, height, false)
509514
if errors.Is(err, datastore.ErrNotFound) {
510515
log.Warnf("attempt to delete header that's not found", "height", height)

0 commit comments

Comments
 (0)