diff --git a/src/main.rs b/src/main.rs index e5968c7..89ebcab 100644 --- a/src/main.rs +++ b/src/main.rs @@ -626,7 +626,8 @@ async fn get_asset_exp_backoff( context:&CloudContext, asset_operation:&rbx_asset::cloud::AssetOperation )->Result{ - let mut backoff:u16=0; + const BACKOFF_MUL:f32=1.3956124250860895286;//exp(1/3) + let mut backoff=1000f32; loop{ match asset_operation.try_get_asset(&context).await{ //try again when the operation is not done @@ -634,10 +635,9 @@ async fn get_asset_exp_backoff( //return all other results other_result=>return other_result, } - let wait=f32::exp(backoff as f32/3.0)*1000f32; - println!("Operation not complete; waiting {:.0}ms...",wait); - tokio::time::sleep(std::time::Duration::from_millis(wait as u64)).await; - backoff+=1; + println!("Operation not complete; waiting {:.0}ms...",backoff); + tokio::time::sleep(std::time::Duration::from_millis(backoff as u64)).await; + backoff*=BACKOFF_MUL; } }