status-im / nim-chronos

Chronos - An efficient library for asynchronous programming
https://status-im.github.io/nim-chronos/docs/chronos
Apache License 2.0
353 stars 51 forks source link

Less flaky rate limit tests #408

Closed Menduist closed 1 year ago

Menduist commented 1 year ago

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