Skip to content

Commit 3f7d64e

Browse files
committed
remove param
1 parent 53dd0fe commit 3f7d64e

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

store/store.go

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7-
"os"
87
"slices"
9-
"strconv"
108
"sync"
119
"sync/atomic"
1210
"time"
@@ -425,22 +423,6 @@ func (s *Store[H]) DeleteTo(ctx context.Context, to uint64) error {
425423
return nil
426424
}
427425

428-
var maxHeadersLoadedPerDelete uint64 = 1024
429-
430-
func init() {
431-
v, ok := os.LookupEnv("HEADER_MAX_LOAD_PER_DELETE")
432-
if !ok {
433-
return
434-
}
435-
436-
max, err := strconv.Atoi(v)
437-
if err != nil {
438-
panic(err)
439-
}
440-
441-
maxHeadersLoadedPerDelete = uint64(max)
442-
}
443-
444426
func (s *Store[H]) deleteRange(ctx context.Context, from, to uint64) (rerr error) {
445427
s.onDeleteMu.Lock()
446428
onDelete := slices.Clone(s.onDelete)
@@ -516,6 +498,7 @@ func (s *Store[H]) setTail(ctx context.Context, batch datastore.Batch, to uint64
516498
if err := writeHeaderHashTo(ctx, batch, newTail, tailKey); err != nil {
517499
return fmt.Errorf("writing tailKey in batch: %w", err)
518500
}
501+
log.Debug("set tail", "height", to)
519502

520503
// update head as well, if delete went over it
521504
head, err := s.Head(ctx)

store/store_test.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ func TestStore_GetRange(t *testing.T) {
526526
}
527527

528528
func TestStore_DeleteTo(t *testing.T) {
529-
maxHeadersLoadedPerDelete = 10
530-
531529
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
532530
t.Cleanup(cancel)
533531

@@ -657,8 +655,6 @@ func TestStore_DeleteTo_EmptyStore(t *testing.T) {
657655
}
658656

659657
func TestStore_DeleteTo_MoveHeadAndTail(t *testing.T) {
660-
maxHeadersLoadedPerDelete = 1
661-
662658
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
663659
t.Cleanup(cancel)
664660

0 commit comments

Comments
 (0)