]> git.proxmox.com Git - proxmox.git/commitdiff
tokio 1.0: delay -> sleep
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 3 Dec 2020 15:04:23 +0000 (16:04 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Thu, 14 Jan 2021 15:01:33 +0000 (16:01 +0100)
almost the same thing, new name(s), no longer Unpin

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
src/server/rest.rs
src/tools/daemon.rs

index 307f888eb47d89b09a478366f0c1ad840216b45a..04bdc5f98a0e117287923781caf14f84d886fe5e 100644 (file)
@@ -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));
                     }
                 }
index 0e3a174a9fe22147014ef0438e431512dc95d97e..d298bf16ed84f41c2d670a0a747b95bea944d376 100644 (file)
@@ -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(())
 }