You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hm.log.Warn("[Tolerating Failure] Rollup boost is partial failure, builder is down but fallback execution client is up", "err", ErrRollupBoostPartiallyHealthy)
// by now, because of three healthchecks, three seconds have been simulated to pass (by the timeProviderFn)
511
+
tp.Now() // simulate another second passing
512
+
// by now, because of three healthchecks, six seconds (CurrentValue + Increment + CurrentValue + Increment + CurrentValue + tp.Now()) have been simulated to pass (by the timeProviderFn)
512
513
// this should reset the time bound counter, thereby allowing partial unhealthiness failures to be tolerated again
513
514
514
-
// first error after the reset is tolerated (time t+4)
515
-
healthStatus=<-healthUpdateCh
516
-
s.Nil(healthStatus)
517
-
s.Len(timeBoundedRotatingCounter.temporalCache, 1) // lazy cleanup of the cache done and it's left with only the current value
518
-
519
-
// second error after the reset is tolerated as well (time t+5)
520
-
healthStatus=<-healthUpdateCh
521
-
s.Nil(healthStatus)
522
-
s.Len(timeBoundedRotatingCounter.temporalCache, 1) // no change to the cache until the next reset
515
+
fourthHealthStatus:=<-healthUpdateCh
516
+
fifthHealthStatus:=<-healthUpdateCh
517
+
sixthHealthStatus:=<-healthUpdateCh
523
518
524
-
// third error after the reset isn't tolerated (time t+6)
returnt.maxValue, fmt.Errorf("counter at its max value, please wait %ds for it to be reset", (t.resetIntervalSeconds- (currentTsSeconds%t.resetIntervalSeconds)))
// a counter with a reset interval of 2 ensuring every two-seconds the counter's cache would track a new key:value
118
111
// we'll trigger the 2-second increment by calling .Increment() and .CurrentValue() because both under the hood, would call .Now() of the mockTimeProvider
119
-
counter, err:=NewTimeBoundedRotatingCounter(2, 9)
112
+
counter, err:=NewTimeBoundedRotatingCounter(2)
120
113
require.NoError(t, err)
121
114
require.NotNil(t, counter)
122
115
counter.timeProviderFn=mockTimeProvider.Now
123
116
124
117
fori:=0; i<1000; i++ {
125
-
_, err:=counter.Increment() // trigger a 1-second time increase
126
-
require.NoError(t, err)
118
+
counter.Increment() // trigger a 1-second time increase
127
119
counter.CurrentValue() // trigger another 1-second time increase, causing the counter interval to reset ensuring next Increment would write a new key in the cache
0 commit comments