From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id D064067678 for ; Tue, 12 Jan 2021 14:59:08 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C7D0C26B68 for ; Tue, 12 Jan 2021 14:58:38 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id A872526B2F for ; Tue, 12 Jan 2021 14:58:37 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6F31E45F5B for ; Tue, 12 Jan 2021 14:58:37 +0100 (CET) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Tue, 12 Jan 2021 14:58:16 +0100 Message-Id: <20210112135830.2798301-7-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> References: <20210112135830.2798301-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.027 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-daily-update.rs, daemon.rs, proxmox-backup-manager.rs, rest.rs, proxmox-tape.rs, proxmox-backup-proxy.rs] Subject: [pbs-devel] [PATCH proxmox-backup 02/12] tokio 1.0: delay -> sleep X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jan 2021 13:59:08 -0000 almost the same thing, new name(s), no longer Unpin Signed-off-by: Fabian Grünbichler --- 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 { if let Some(httperr) = err.downcast_ref::() { 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 { } 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