Skip to content

Commit

Permalink
fix: change scan block step
Browse files Browse the repository at this point in the history
  • Loading branch information
saitofun committed Jul 15, 2024
1 parent bd9cac1 commit 3dd03dd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cmd/sequencer/config/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PEBBLE_SEQUENCER__LarkAlert_Env: PROD
PEBBLE_SEQUENCER__LarkAlert_Project: pebble-sequencer
PEBBLE_SEQUENCER__LarkAlert_Secret: ""
PEBBLE_SEQUENCER__LarkAlert_URL: ""
PEBBLE_SEQUENCER__LarkAlert_Version: v0.2.2-1-gaccdfb7
PEBBLE_SEQUENCER__LarkAlert_Version: ""
PEBBLE_SEQUENCER__Logger_Level: DEBUG
PEBBLE_SEQUENCER__MqttBroker_Cert_CA: ""
PEBBLE_SEQUENCER__MqttBroker_Cert_Crt: ""
Expand Down
3 changes: 2 additions & 1 deletion pkg/middlewares/blockchain/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ func (m *Monitor) run(ctx context.Context) {
FromBlock: new(big.Int),
ToBlock: new(big.Int),
}
step := uint64(1000)
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -164,7 +165,7 @@ func (m *Monitor) run(ctx context.Context) {
if from >= current {
goto TryLater
}
to = min(current, from+100000)
to = min(current, from+step)
filter.FromBlock.SetUint64(from)
filter.ToBlock.SetUint64(to)
results, err = m.client.FilterLogs(ctx, filter)
Expand Down
3 changes: 2 additions & 1 deletion pkg/middlewares/blockchain/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func (w *watcher) fields(others ...any) []any {
}

func (w *watcher) run(ctx context.Context) {
step := uint64(1000)
for {
select {
case <-ctx.Done():
Expand All @@ -97,7 +98,7 @@ func (w *watcher) run(ctx context.Context) {
if from >= current {
goto TryLater
}
to = min(current, from+100000)
to = min(current, from+step)
results, err = w.persist.QueryTxByHeightRange(w.meta, from, to)
if err != nil {
goto Failed
Expand Down

0 comments on commit 3dd03dd

Please sign in to comment.