File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
backend/pkg/exporter/modules Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 77 "fmt"
88 "math/big"
99 "sync"
10+ "time"
1011
1112 "github.com/gobitfly/beaconchain/pkg/commons/db"
1213 "github.com/gobitfly/beaconchain/pkg/commons/log"
@@ -21,6 +22,7 @@ import (
2122type executionPayloadsExporter struct {
2223 ModuleContext ModuleContext
2324 ExportMutex * sync.Mutex
25+ CooldownTs time.Time
2426}
2527
2628func NewExecutionPayloadsExporter (moduleContext ModuleContext ) ModuleInterface {
@@ -31,6 +33,10 @@ func NewExecutionPayloadsExporter(moduleContext ModuleContext) ModuleInterface {
3133}
3234
3335func (d * executionPayloadsExporter ) OnHead (event * constypes.StandardEventHeadResponse ) (err error ) {
36+ if time .Now ().Before (d .CooldownTs ) {
37+ log .Warnf ("execution rewards finalizer is on cooldown till %s" , d .CooldownTs )
38+ return nil
39+ }
3440 // if mutex is locked, return early
3541 if ! d .ExportMutex .TryLock () {
3642 log .Infof ("execution payloads exporter is already running" )
@@ -39,6 +45,7 @@ func (d *executionPayloadsExporter) OnHead(event *constypes.StandardEventHeadRes
3945 defer d .ExportMutex .Unlock ()
4046 err = d .maintainTable ()
4147 if err != nil {
48+ d .CooldownTs = time .Now ().Add (1 * time .Minute )
4249 return fmt .Errorf ("error maintaining table: %w" , err )
4350 }
4451 return nil
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ func (d *executionRewardsFinalizer) OnFinalizedCheckpoint(event *constypes.Stand
4949func (d * executionRewardsFinalizer ) OnHead (event * constypes.StandardEventHeadResponse ) (err error ) {
5050 if time .Now ().Before (d .CooldownTs ) {
5151 log .Warnf ("execution rewards finalizer is on cooldown till %s" , d .CooldownTs )
52+ return nil
5253 }
5354 // if mutex is locked, return early
5455 if ! d .ExportMutex .TryLock () {
You can’t perform that action at this time.
0 commit comments