Skip to content

Commit

Permalink
feat(http-ratelimiting)!: rewrite crate
Browse files Browse the repository at this point in the history
Support buckets and global limit. Work in progress...
  • Loading branch information
Tim Vilgot Mikael Fredenberg authored and vilgotf committed Feb 16, 2025
1 parent dcadfb5 commit e74289c
Show file tree
Hide file tree
Showing 14 changed files with 703 additions and 1,675 deletions.
2 changes: 1 addition & 1 deletion examples/http-proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ async fn main() -> anyhow::Result<()> {

let client = Client::builder()
.proxy("localhost:3000".to_owned(), true)
.ratelimiter(None)
.ratelimiter(false)
.build();
let channel_id = Id::new(620_980_184_606_048_278);

Expand Down
4 changes: 3 additions & 1 deletion twilight-http-ratelimiting/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ rust-version.workspace = true
version = "0.16.0"

[dependencies]
tokio = { version = "1", default-features = false, features = ["rt", "sync", "time"] }
hashbrown = { default-features = false, version = "0.15"}
tokio = { default-features = false, features = ["macros", "rt", "sync", "time"], version = "1.29" }
tokio-util = { default-features = false, features = ["time"], version = "0.7.11" }
tracing = { default-features = false, features = ["std", "attributes"], version = "0.1.23" }

[dev-dependencies]
Expand Down
5 changes: 5 additions & 0 deletions twilight-http-ratelimiting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ implementations need to implement.
It also ships a default implementation, [`InMemoryRatelimiter`], that manages
the bucket states in memory.

Dropped pending permit futures are skipped.

Permits are sequentially completed per queue, so permits should not be held for
longer than necessary.

[Discord's documentation]: https://discord.com/developers/docs/topics/rate-limits
28 changes: 0 additions & 28 deletions twilight-http-ratelimiting/benches/headers.rs

This file was deleted.

Loading

0 comments on commit e74289c

Please sign in to comment.