Skip to content

Commit

Permalink
Use unlimited_rate_sentinel
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Nov 26, 2024
1 parent fd1afe2 commit a0ca33d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions nano/lib/rate_limiting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ nano::rate::token_bucket::token_bucket (std::size_t max_token_count_a, std::size
reset (max_token_count_a, refill_rate_a);
}

bool nano::rate::token_bucket::try_consume (unsigned tokens_required)
bool nano::rate::token_bucket::try_consume (std::size_t tokens_required)
{
debug_assert (tokens_required <= 1e9);
debug_assert (tokens_required <= unlimited_rate_sentinel);

refill ();

Expand Down
2 changes: 1 addition & 1 deletion nano/lib/rate_limiting.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class token_bucket
* The default cost is 1 token, but resource intensive operations may request
* more tokens to be available.
*/
bool try_consume (unsigned tokens_required = 1);
bool try_consume (std::size_t tokens_required = 1);

/** Update the max_token_count and/or refill_rate_a parameters */
void reset (std::size_t max_token_count, std::size_t refill_rate);
Expand Down

0 comments on commit a0ca33d

Please sign in to comment.