Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: re-enqueue failed block after average block time #73

Merged
merged 9 commits into from
Sep 2, 2022
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased
### Changes
- ([\#73](https://github.com/forbole/juno/pull/73)) re-enqueue failed block after average block time

## v3.3.0
### Changes
- ([\#67](https://github.com/forbole/juno/pull/67)) Added support for concurrent transaction handling
Expand Down
5 changes: 4 additions & 1 deletion parser/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package parser
import (
"encoding/json"
"fmt"
"time"

"github.com/forbole/juno/v3/logging"

Expand Down Expand Up @@ -60,7 +61,9 @@ func (w Worker) Start() {

for i := range w.queue {
if err := w.ProcessIfNotExists(i); err != nil {
// re-enqueue any failed job
// re-enqueue any failed job after average block time
time.Sleep(config.Cfg.Parser.AvgBlockTime)
huichiaotsou marked this conversation as resolved.
Show resolved Hide resolved

// TODO: Implement exponential backoff or max retries for a block height.
go func() {
w.logger.Error("re-enqueueing failed block", "height", i, "err", err)
Expand Down