diff --git a/src/util.rs b/src/util.rs index 0e5f063..c681307 100644 --- a/src/util.rs +++ b/src/util.rs @@ -15,6 +15,7 @@ use std::error::Error; use tokio::{ fs::{create_dir_all, remove_file, File}, io::copy, + time::{sleep, Duration}, }; /// Generate associative table between media ids and tweet extended entities @@ -85,6 +86,7 @@ pub async fn generate_media_ids( /// Wait on uploaded medias when necessary async fn wait_until_uploaded(client: &Mastodon, id: &str) -> Result { loop { + sleep(Duration::from_secs(1)).await; let res = client.get_media(id.to_string()).await; return match res { Ok(res) => Ok(res.json.id),