This solves RetryWithConfig issues in both the Random: true and Random: false cases.
When Random: false, the function sets the timeout to be the current timeout modulo the max timeout rather than the minimum of the two. This causes cyclic timeout patterns such as:
The real problem arises with Random: true, which happens with the PooledClient used to communicate with the web3 gateway. Entropy is introduced by multiplying by a random value in [0, 1), which disproportionately causes the timeout to never really grow and in fact shrink past it's base timeout. I changed this to select a random value from [0.5, 1.5) when the max timeout hasn't been hit and [1, 2) in the case when it has, and this gave rise to nicer (empirically observed) patterns. E.g:
This solves
RetryWithConfig
issues in both theRandom: true
andRandom: false
cases.When
Random: false
, the function sets the timeout to be the current timeout modulo the max timeout rather than the minimum of the two. This causes cyclic timeout patterns such as:1000000 3000000 7000000 9000000 1000000 3000000 7000000 9000000
The real problem arises with
Random: true
, which happens with thePooledClient
used to communicate with the web3 gateway. Entropy is introduced by multiplying by a random value in[0, 1)
, which disproportionately causes the timeout to never really grow and in fact shrink past it's base timeout. I changed this to select a random value from[0.5, 1.5)
when the max timeout hasn't been hit and[1, 2)
in the case when it has, and this gave rise to nicer (empirically observed) patterns. E.g:1000000 2209321 6365094 14377142 16868231 11565193 13009119 18136400 13806572 14688899