Create multiple assets concurrently #5

Merged
Quaternions merged 16 commits from staging into master 2024-08-17 18:00:28 +00:00
Showing only changes of commit f5d50a0de2 - Show all commits

View File

@ -626,7 +626,8 @@ async fn get_asset_exp_backoff(
context:&CloudContext,
asset_operation:&rbx_asset::cloud::AssetOperation
)->Result<rbx_asset::cloud::AssetResponse,rbx_asset::cloud::AssetOperationError>{
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;
}
}