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
MinDelay=1*time.Second// Initial delay for retry interval.
29
-
MaxInterval=60*time.Second// Maximum interval an individual retry may have.
30
-
MaxElapsedTime=0*time.Second// Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
31
-
RetryFactorfloat64=2// Multiplier factor computed exponential retry interval is scaled by.
32
-
NumRetriesuint64=3// Total number of retries attempted.
33
-
MinDelayChain=12*time.Second// Initial delay for retry interval for contract calls. Corresponds to 1 ethereum block.
34
-
MaxIntervalChain=2*time.Minute// Maximum interval for an individual retry.
28
+
DefaultInitialInterval=1*time.Second// Initial delay for retry interval.
29
+
DefaultMaxInterval=60*time.Second// Maximum interval an individual retry may have.
30
+
DefaultMaxElapsedTime=0*time.Second// Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
31
+
DefaultRandomizationFactorfloat64=0// Randomization (Jitter) factor used to map retry interval to a range of values around the computed interval. In precise terms (random value in range [1 - randomizationfactor, 1 + randomizationfactor]). NOTE: This is set to 0 as we do not use jitter in Aligned.
32
+
DefaultMultiplierfloat64=2// Multiplier factor computed exponential retry interval is scaled by.
33
+
DefaultNumRetriesuint64=3// Total number of retries attempted.
34
+
ChainInitialInterval=12*time.Second// Initial delay for retry interval for contract calls. Corresponds to 1 ethereum block.
35
+
ChainMaxInterval=2*time.Minute// Maximum interval for an individual retry.
35
36
)
36
37
38
+
typeRetryConfigstruct {
39
+
InitialInterval time.Duration// Initial delay for retry interval.
40
+
MaxInterval time.Duration// Maximum interval an individual retry may have.
41
+
MaxElapsedTime time.Duration// Maximum time all retries may take. `0` corresponds to no limit on the time of the retries.
42
+
RandomizationFactorfloat64
43
+
Multiplierfloat64
44
+
NumRetriesuint64
45
+
}
46
+
47
+
funcDefaultRetryConfig() *RetryConfig {
48
+
return&RetryConfig{
49
+
InitialInterval: DefaultInitialInterval,
50
+
MaxInterval: DefaultMaxInterval,
51
+
MaxElapsedTime: DefaultMaxElapsedTime,
52
+
RandomizationFactor: DefaultRandomizationFactor,
53
+
Multiplier: DefaultMultiplier,
54
+
NumRetries: DefaultNumRetries,
55
+
}
56
+
}
57
+
58
+
funcChainRetryConfig() *RetryConfig {
59
+
return&RetryConfig{
60
+
InitialInterval: ChainInitialInterval,
61
+
MaxInterval: ChainMaxInterval,
62
+
MaxElapsedTime: DefaultMaxElapsedTime,
63
+
RandomizationFactor: DefaultRandomizationFactor,
64
+
Multiplier: DefaultMultiplier,
65
+
NumRetries: DefaultNumRetries,
66
+
}
67
+
}
68
+
37
69
/*
38
70
Retry and RetryWithData are custom retry functions used in Aligned's aggregator and operator to facilitate consistent retry logic across the system.
39
71
They are interfaces for around Cenk Alti (https://github.com/cenkalti) backoff library (https://github.com/cenkalti/backoff). We would like to thank him for his great work.
0 commit comments