Rod Taylor <[EMAIL PROTECTED]> writes: > How about (round to nearest 10msec):
> time =3D oldtime + oldtime / 2 + oldtime * rand() > while (time > 1 second) > time =3D time - 0.80sec > This would stagger the wakeup times, and ensure a larger number of > retries -- but the times should be large enough after the first few > tries (larger than 200msec) that further backoff won't be required. But after the first few tries the sleep time would always exceed 200msec, so there would be a *maximum* of 60*5 = 300 tries before failing --- probably a lot less, like about 120 on average. The random component should already help to scatter the wakeups pretty well, so I'm thinking about just if (oldtime > 1 sec) time = 10msec else time = oldtime + oldtime * rand() ie random growth of a maximum of 2x per try, and reset to minimum delay when you get past 1 sec. This would guarantee at least as many tries as I'm getting currently with the deterministic algorithm (which is effectively this if rand() always returned 1). regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]