Let the caller specify the "now" (which outside of tests, can be useful to avoid querying the clock multiple times, if the caller already knows the now)
In sync test, modify the now parameter instead of sleeping to avoid flakyness
In async tests, this is unfortunately not possible since the worker will actually sleep to wait for the bucket to fill
Let the caller specify the "now" (which outside of tests, can be useful to avoid querying the clock multiple times, if the caller already knows the
now
)In sync test, modify the
now
parameter instead of sleeping to avoid flakyness In async tests, this is unfortunately not possible since theworker
will actually sleep to wait for the bucket to fill