rate: Set initial bucket level correctly.
commit9ca978d8c11f0e9eecd61474505ecdaa4695b8da
authorRichard W.M. Jones <rjones@redhat.com>
Tue, 2 Apr 2019 09:54:36 +0000 (2 10:54 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Tue, 2 Apr 2019 10:54:08 +0000 (2 11:54 +0100)
treec3ee6790ba4764404dee39c4de1d8684aa5bb003
parentfc3371e0f32176e5cbec924714cc922cc8a216ea
rate: Set initial bucket level correctly.

It was previously set to the capacity ratio in seconds, not the true
capacity in tokens, meaning it would always have started off nearly
empty (2 tokens, in fact).

This also affects the test.  Because the bucket is now full at the
start, the filter will burst a little initially and so the test takes
slightly less time to run (measured just over 19 seconds).  Therefore
we must adjust the test to subtract a little bit of grace time.

Fixes commit fa41958159af0c9ddaff7ae55481adebee45daeb.
filters/rate/bucket.c
tests/test-rate.sh