uber-go / ratelimit

A Go blocking leaky-bucket rate limit implementation
MIT License
4.32k stars 300 forks source link

Update example to include a withoutSlack option #96

Closed rabbbit closed 2 years ago

rabbbit commented 2 years ago

In #90 @twelsh-aw found a bug in a new implementation. This turned out to be caused by us mocking time.

Since time mocking will always have some risks this diff proposes to expand the examples we're using - since they use "real" time they should be good enough to cover most basic cases like #90.

In particular:

Possible issues:

codecov[bot] commented 2 years ago

Codecov Report

Merging #96 (0917cd8) into main (783ade2) will not change coverage. The diff coverage is n/a.

@@            Coverage Diff            @@
##              main       #96   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines           97        97           
=========================================
  Hits            97        97           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 783ade2...0917cd8. Read the comment docs.

rabbbit commented 2 years ago

Hey @storozhukBM WDYT?

storozhukBM commented 2 years ago

@rabbbit looks good