Skip to content

Commit 97f4c6e

Browse files
committed
feat_: Flush hystrix on going back online
When going offline, all the rpc calls fail making hystrix open all the circuits. This commit changes the behavior so that when we go back online, we close all the circuits. We should also avoid making rpc requests while offline, but this should work for release.
1 parent a6645bd commit 97f4c6e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

api/geth_backend.go

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515

1616
"go.uber.org/zap"
1717

18+
"github.com/afex/hystrix-go/hystrix"
1819
"github.com/pkg/errors"
1920

2021
"github.com/imdario/mergo"
@@ -2434,6 +2435,12 @@ func (b *GethStatusBackend) ConnectionChange(typ string, expensive bool) {
24342435

24352436
b.log.Info("Network state change", "old", b.connectionState, "new", state)
24362437

2438+
if b.connectionState.Offline && !state.Offline {
2439+
// flush hystrix if we are going again online, since it doesn't behave
2440+
// well when offline
2441+
hystrix.Flush()
2442+
}
2443+
24372444
b.connectionState = state
24382445
b.statusNode.ConnectionChanged(state)
24392446

0 commit comments

Comments
 (0)