Skip to content

Commit

Permalink
polygon/heimdall: add ErrServiceUnavailable transient err (#12173)
Browse files Browse the repository at this point in the history
fixes a crash when running astrid
```
[DBUG] [10-02|04:14:04.330] Error while executing stage              err="[2/6 PolygonSync] stopped: service unavailable: url='https://heimdall-api-amoy.polygon.technology/milestone/count', status=503"
[EROR] [10-02|04:14:04.330] [2/6 PolygonSync] stopping node          err="service unavailable: url='https://heimdall-api-amoy.polygon.technology/milestone/count', status=503"
```
  • Loading branch information
taratorio authored Oct 2, 2024
1 parent c85363c commit 95d3780
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion polygon/bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,20 @@ func Assemble(config Config) *Bridge {
}

func NewBridge(store Store, logger log.Logger, borConfig *borcfg.BorConfig, eventFetcher eventFetcher, reader *Reader) *Bridge {
transientErrors := []error{
heimdall.ErrBadGateway,
heimdall.ErrServiceUnavailable,
context.DeadlineExceeded,
}

return &Bridge{
store: store,
logger: logger,
borConfig: borConfig,
eventFetcher: eventFetcher,
stateReceiverContractAddress: libcommon.HexToAddress(borConfig.StateReceiverContract),
reader: reader,
transientErrors: []error{context.DeadlineExceeded, heimdall.ErrBadGateway},
transientErrors: transientErrors,
fetchedEventsSignal: make(chan struct{}),
processedBlocksSignal: make(chan struct{}),
}
Expand Down
1 change: 1 addition & 0 deletions polygon/heimdall/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func newService(calculateSprintNumberFn CalculateSprintNumberFunc, client Heimda
spanFetcher := newSpanFetcher(client, logger)
commonTransientErrors := []error{
ErrBadGateway,
ErrServiceUnavailable,
context.DeadlineExceeded,
}

Expand Down

0 comments on commit 95d3780

Please sign in to comment.