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 ;-).
Best regards,
Albert -- Albert Brandl Weiermayer Solutions GmbH | Abteistraße 12, A-4813 Altmünster phone: +43 (0) 720 70 30 14 | fax: +43 (0) 7612 20 3 56 web: http://www.weiermayer.com
On 12:01 pm, albert.brandl@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