Bump scaling to 1000.
Note the error in integer arithmetic
This commit is contained in:
@@ -34,6 +34,13 @@
|
||||
*
|
||||
* uc_ratelimit_init(&r,20, 1, time(NULL));
|
||||
*
|
||||
* NOTE. The the internals uses integer arithmetic to replenish the tickets,
|
||||
* this can lead to greater errors estimating the available tickets the smaller
|
||||
* the number of tickets is in relation to the period. The arithmetic is scaled
|
||||
* by 1000 currently, so if ticket = 1 and period = 60, we get 1000/60 = 16. This
|
||||
* should be 16.6667, which is an error of about 3.6%, which means we really just
|
||||
* rate limit to 1 per 62 seconds.
|
||||
*
|
||||
* for (;;) {
|
||||
* int fd = accept(..);
|
||||
* if (uc_ratelimit_allow(&r, time(NULL)) {
|
||||
|
||||
Reference in New Issue
Block a user