Skip to content

Commit

Permalink
Provide a common atomic Rate Limiter implementation (#560)
Browse files Browse the repository at this point in the history
* Provide a common atomic Rate Limiter implementation

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>

* Use proper high resolution monotonic timer on windows

* Add minimal sleep for test stability

* Disable shellcheck warning

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>

* Fix aftrer rebase

* Validate rate() in test

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>

* Validate limit change in test

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>

* Work around floating point precision issues

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>

* Update rate_limiter.rs

---------

Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
  • Loading branch information
bwoebi committed Sep 4, 2024
1 parent d4dd94f commit 081589b
Show file tree
Hide file tree
Showing 14 changed files with 760 additions and 69 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ jobs:
run: rustup install ${{ matrix.rust_version }} && rustup default ${{ matrix.rust_version }} && rustup component add clippy
- name: Run clippy on ${{ matrix.platform }} ${{ matrix.rust_version }}
shell: bash
run: cargo clippy --all-targets --all-features -- -D warnings "$([ ${{ matrix.rust_version }} = 1.71.1 ] && echo -Aunknown-lints)"
run: |
# shellcheck disable=SC2046
cargo clippy --all-targets --all-features -- -D warnings $([ ${{ matrix.rust_version }} = 1.71.1 ] && echo -Aunknown-lints -Aclippy::cast_ref_to_mut)
licensecheck:
runs-on: ubuntu-latest
name: "Presence of licence headers"
Expand Down
64 changes: 37 additions & 27 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 081589b

Please sign in to comment.