Improve the stability of the rate limiter.

The previous version could lead to oscillations:
twice the rate limit in one minute, zero the next, etc.