Skip to content

Commit

Permalink
add log for test_rate_limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenRi committed Oct 31, 2023
1 parent 544a6a4 commit 842fe94
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/coro_io/tests/test_rate_limiter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,17 @@ TEST_CASE("test SmoothBurstyRateLimiter multi coroutine") {
double cost_diff = 0.1;

coro_io::SmoothBurstyRateLimiter rateLimiter(permits_per_second);
auto consumer = [&]() -> async_simple::coro::Lazy<void> {
auto consumer = [&](int coroutine_num) -> async_simple::coro::Lazy<void> {
for (int i = 0; i < permits_to_acquire_every_coroutine; i++) {
co_await rateLimiter.acquire(1);
ELOG_INFO << "coroutine " << coroutine_num << " acquired";
}
};

auto consumerListLazy = [&]() -> async_simple::coro::Lazy<void> {
std::vector<async_simple::coro::Lazy<void>> lazyList;
for (int i = 0; i < num_of_coroutine; i++) {
lazyList.push_back(consumer());
lazyList.push_back(consumer(i));
}
co_await collectAllPara(std::move(lazyList));
};
Expand Down

0 comments on commit 842fe94

Please sign in to comment.