[Twisted-Python] Inconsistency in ReconnectingClientFactory
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Wed Nov 3 08:10:59 MDT 2010
On 12:01 pm, albert.brandl at weiermayer.com wrote:
>Hi!
>
>The ReconnectingClientFactory class allows to define the instance
>variable maxDelay. Its documentation is "Maximum number of seconds
>between connection attempts."
>
>maxDelay is used in the retry() method to bound self.delay. But this
>happens in the _first_ step of the calculation of self.delay.
>Afterwards, the bounded value is modified again by applying
>random.normalvariate to allow for the jitter. This can result in a
>value
>that is considerably bigger than maxDelay.
>
>Is there any reason that maxDelay is not used for bounding the final
>result of the calculation of self.delay? If not, the calculation should
>be fixed - I'd be happy to file an issue ;-).
One reason to prefer not to have a fixed value as maxDelay is that
always picking a random values ensures that you'll never have a stampede
of clients all attempting connections at once. It might be best to just
correct the documentation for maxDelay to point out that it's not
actually a hard maximum, just the average value the maximums will
cluster around. That's certainly worth a ticket.
Jean-Paul
More information about the Twisted-Python
mailing list