From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 02/12] tokio 1.0: delay -> sleep
Date: Tue, 12 Jan 2021 14:58:16 +0100 [thread overview]
Message-ID: <20210112135830.2798301-7-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20210112135830.2798301-1-f.gruenbichler@proxmox.com>
almost the same thing, new name(s), no longer Unpin
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
src/bin/proxmox-backup-manager.rs | 2 +-
src/bin/proxmox-backup-proxy.rs | 6 +++---
src/bin/proxmox-daily-update.rs | 2 +-
src/bin/proxmox-tape.rs | 2 +-
src/client/http_client.rs | 2 +-
src/server/rest.rs | 8 ++++----
src/tools/daemon.rs | 8 ++++----
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/src/bin/proxmox-backup-manager.rs b/src/bin/proxmox-backup-manager.rs
index ff2a1dc1..c114079a 100644
--- a/src/bin/proxmox-backup-manager.rs
+++ b/src/bin/proxmox-backup-manager.rs
@@ -41,7 +41,7 @@ pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
loop {
if proxmox_backup::server::worker_is_active_local(&upid) {
- tokio::time::delay_for(sleep_duration).await;
+ tokio::time::sleep(sleep_duration).await;
} else {
break;
}
diff --git a/src/bin/proxmox-backup-proxy.rs b/src/bin/proxmox-backup-proxy.rs
index 6414d646..2228253d 100644
--- a/src/bin/proxmox-backup-proxy.rs
+++ b/src/bin/proxmox-backup-proxy.rs
@@ -262,7 +262,7 @@ async fn run_task_scheduler() {
Ok(d) => d,
Err(err) => {
eprintln!("task scheduler: compute next minute failed - {}", err);
- tokio::time::delay_until(tokio::time::Instant::from_std(Instant::now() + Duration::from_secs(60))).await;
+ tokio::time::sleep_until(tokio::time::Instant::from_std(Instant::now() + Duration::from_secs(60))).await;
continue;
}
};
@@ -286,7 +286,7 @@ async fn run_task_scheduler() {
}
}
- tokio::time::delay_until(tokio::time::Instant::from_std(delay_target)).await;
+ tokio::time::sleep_until(tokio::time::Instant::from_std(delay_target)).await;
}
}
@@ -649,7 +649,7 @@ async fn run_stat_generator() {
generate_host_stats(save).await;
- tokio::time::delay_until(tokio::time::Instant::from_std(delay_target)).await;
+ tokio::time::sleep_until(tokio::time::Instant::from_std(delay_target)).await;
}
diff --git a/src/bin/proxmox-daily-update.rs b/src/bin/proxmox-daily-update.rs
index b78d1643..99f5152e 100644
--- a/src/bin/proxmox-daily-update.rs
+++ b/src/bin/proxmox-daily-update.rs
@@ -14,7 +14,7 @@ async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
if !proxmox_backup::server::worker_is_active_local(&upid) {
break;
}
- tokio::time::delay_for(sleep_duration).await;
+ tokio::time::sleep(sleep_duration).await;
}
Ok(())
}
diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
index 4850008a..d9a84060 100644
--- a/src/bin/proxmox-tape.rs
+++ b/src/bin/proxmox-tape.rs
@@ -65,7 +65,7 @@ pub async fn wait_for_local_worker(upid_str: &str) -> Result<(), Error> {
loop {
if worker_is_active_local(&upid) {
- tokio::time::delay_for(sleep_duration).await;
+ tokio::time::sleep(sleep_duration).await;
} else {
break;
}
diff --git a/src/client/http_client.rs b/src/client/http_client.rs
index 92df9572..7febbe51 100644
--- a/src/client/http_client.rs
+++ b/src/client/http_client.rs
@@ -345,7 +345,7 @@ impl HttpClient {
let renewal_future = async move {
loop {
- tokio::time::delay_for(Duration::new(60*15, 0)).await; // 15 minutes
+ tokio::time::sleep(Duration::new(60*15, 0)).await; // 15 minutes
let (auth_id, ticket) = {
let authinfo = auth2.read().unwrap().clone();
(authinfo.auth_id, authinfo.ticket)
diff --git a/src/server/rest.rs b/src/server/rest.rs
index 307f888e..04bdc5f9 100644
--- a/src/server/rest.rs
+++ b/src/server/rest.rs
@@ -385,7 +385,7 @@ pub async fn handle_api_request<Env: RpcEnvironment, S: 'static + BuildHasher +
Err(err) => {
if let Some(httperr) = err.downcast_ref::<HttpError>() {
if httperr.code == StatusCode::UNAUTHORIZED {
- tokio::time::delay_until(Instant::from_std(delay_unauth_time)).await;
+ tokio::time::sleep_until(Instant::from_std(delay_unauth_time)).await;
}
}
(formatter.format_error)(err)
@@ -708,7 +708,7 @@ async fn handle_request(
// always delay unauthorized calls by 3 seconds (from start of request)
let err = http_err!(UNAUTHORIZED, "authentication failed - {}", err);
- tokio::time::delay_until(Instant::from_std(delay_unauth_time)).await;
+ tokio::time::sleep_until(Instant::from_std(delay_unauth_time)).await;
return Ok((formatter.format_error)(err));
}
}
@@ -723,7 +723,7 @@ async fn handle_request(
let auth_id = rpcenv.get_auth_id();
if !check_api_permission(api_method.access.permission, auth_id.as_deref(), &uri_param, user_info.as_ref()) {
let err = http_err!(FORBIDDEN, "permission check failed");
- tokio::time::delay_until(Instant::from_std(access_forbidden_time)).await;
+ tokio::time::sleep_until(Instant::from_std(access_forbidden_time)).await;
return Ok((formatter.format_error)(err));
}
@@ -765,7 +765,7 @@ async fn handle_request(
return Ok(get_index(Some(userid.clone()), Some(new_csrf_token), language, &api, parts));
},
_ => {
- tokio::time::delay_until(Instant::from_std(delay_unauth_time)).await;
+ tokio::time::sleep_until(Instant::from_std(delay_unauth_time)).await;
return Ok(get_index(None, None, language, &api, parts));
}
}
diff --git a/src/tools/daemon.rs b/src/tools/daemon.rs
index 0e3a174a..d298bf16 100644
--- a/src/tools/daemon.rs
+++ b/src/tools/daemon.rs
@@ -331,17 +331,17 @@ async fn get_service_state(service: &str) -> Result<String, Error> {
}
async fn wait_service_is_state(service: &str, state: &str) -> Result<(), Error> {
- tokio::time::delay_for(std::time::Duration::new(1, 0)).await;
+ tokio::time::sleep(std::time::Duration::new(1, 0)).await;
while get_service_state(service).await? != state {
- tokio::time::delay_for(std::time::Duration::new(5, 0)).await;
+ tokio::time::sleep(std::time::Duration::new(5, 0)).await;
}
Ok(())
}
async fn wait_service_is_not_state(service: &str, state: &str) -> Result<(), Error> {
- tokio::time::delay_for(std::time::Duration::new(1, 0)).await;
+ tokio::time::sleep(std::time::Duration::new(1, 0)).await;
while get_service_state(service).await? == state {
- tokio::time::delay_for(std::time::Duration::new(5, 0)).await;
+ tokio::time::sleep(std::time::Duration::new(5, 0)).await;
}
Ok(())
}
--
2.20.1
next prev parent reply other threads:[~2021-01-12 13:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 13:58 [pbs-devel] [PATCH-SERIES 0/20] update to tokio 1.0 and friends Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox 1/4] Cargo.toml: update to tokio 1.0 Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox 2/4] update to rustyline 7 Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox 3/4] update to tokio 1.0 Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox 4/4] tokio 1.0: drop TimeoutFutureExt Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 01/12] update to tokio 1.0 Fabian Grünbichler
2021-01-12 13:58 ` Fabian Grünbichler [this message]
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 03/12] proxmox XXX: use tokio::time::timeout directly Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 04/12] tokio 1.0: AsyncRead/Seek with ReadBuf Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 05/12] tokio: adapt to 1.0 runtime changes Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 06/12] tokio: adapt to 1.0 process:Child changes Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 07/12] tokio 1.0: use ReceiverStream from tokio-stream Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 08/12] tokio 1.0: update to new tokio-openssl interface Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 09/12] tokio 1.0: update to new Signal interface Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 10/12] hyper: use new hyper::upgrade Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 11/12] examples: unify h2 examples Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-backup 12/12] cleanup: remove unnecessary 'mut' and '.clone()' Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH proxmox-fuse] update to tokio 1.0 Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [PATCH pxar 1/3] " Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [RFC pxar 2/3] clippy: use matches! instead of match Fabian Grünbichler
2021-01-12 13:58 ` [pbs-devel] [RFC pxar 3/3] remove futures-io feature Fabian Grünbichler
2021-01-12 14:42 ` Wolfgang Bumiller
2021-01-12 14:52 ` [pbs-devel] [PATCH-SERIES 0/20] update to tokio 1.0 and friends Wolfgang Bumiller
2021-01-14 13:39 ` [pbs-devel] [PATCH proxmox 1/3] fix u2f example Fabian Grünbichler
2021-01-14 13:39 ` [pbs-devel] [PATCH proxmox-backup] proxmox XXX: adapt to moved ParameterSchema Fabian Grünbichler
2021-01-14 13:39 ` [pbs-devel] [PATCH proxmox 2/3] move ParameterSchema from router to schema Fabian Grünbichler
2021-01-14 13:39 ` [pbs-devel] [PATCH proxmox 3/3] build: add autopkgtest target Fabian Grünbichler
2021-01-14 13:41 ` [pbs-devel] [PATCH pxar 1/2] fix example Fabian Grünbichler
2021-01-14 13:41 ` [pbs-devel] [PATCH pxar 2/2] build: fix --no-default-features Fabian Grünbichler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210112135830.2798301-7-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox