[Twisted-Python] spread.sturdy reconnect delay
Jp Calderone
exarkun at meson.dyndns.org
Sun Aug 4 17:49:05 MDT 2002
On Mon, Aug 05, 2002 at 08:18:12AM +1000, Donovan Baarda wrote:
> On Sat, Aug 03, 2002 at 02:55:33AM +0200, Paul Boehm wrote:
> > [snip]
> [snip]
>
> What about exponential backoff...
>
> *) try, sleep i, i=i*2, repeat
>
FWIW, this is essentially the approach I used in my mud client ;P It
works fairly well. The one important difference is there's a cap on the
wait time (I use 2^17 seconds, or ~36 minutes). I think this gives a good
balance between getting reconnected quickly and not flooding the destination
with connection attempts. Of course this pattern is pretty easily
generalizable -- a factory with two parameters, the growth factor and the
cap. Might it be a good idea to include a few of the simpler approaches
somewhere? The code for most of these probably wouldn't be more than 5
lines, but having them all collected, pre-written, and of course bug-free
would be pretty handy IMHO. Actually, now I'm thinking of some kind of
policy objects instead of Factory subclasses - something that can be shared
between factories or swapped around as desired without rebuilding your
factories.
Jp
--
"Pascal is Pascal is Pascal is dog meat."
-- M. Devine and P. Larson, Computer Science 340
--
7:38pm up 75 days, 20:26, 6 users, load average: 0.14, 0.09, 0.03
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 237 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20020804/8a0044ba/attachment.sig>
More information about the Twisted-Python
mailing list