Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor work* #281

Merged
merged 1 commit into from
Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@
}
}

async fn work(&self, client_state: &mut ClientState) -> Result<RequestResult, ClientError> {

Check failure on line 302 in src/client.rs

View workflow job for this annotation

GitHub Actions / Clippy

this argument is a mutable reference, but not used mutably

Check failure on line 302 in src/client.rs

View workflow job for this annotation

GitHub Actions / Clippy

this argument is a mutable reference, but not used mutably
let timeout = if let Some(timeout) = self.timeout {
tokio::time::sleep(timeout).boxed()
} else {
Expand Down Expand Up @@ -666,16 +666,18 @@
// Handle via rate till n_tasks out of bound
while n + rate < n_tasks {
tokio::time::sleep(duration).await;
let now = std::time::Instant::now();
for _ in 0..rate {
tx.send_async(std::time::Instant::now()).await.unwrap();
tx.send_async(now).await.unwrap();
}
n += rate;
}
// Handle the remaining tasks
if n_tasks > n {
tokio::time::sleep(duration).await;
let now = std::time::Instant::now();
for _ in 0..n_tasks - n {
tx.send_async(std::time::Instant::now()).await.unwrap();
tx.send_async(now).await.unwrap();
}
}
// tx gone
Expand Down
Loading