From 1c044191bed4063dfcdb19b7f6ee93439c300877 Mon Sep 17 00:00:00 2001 From: David Renshaw Date: Tue, 13 Sep 2022 14:58:05 -0400 Subject: [PATCH] fix media upload in create_tweet example --- examples/create_tweet.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/examples/create_tweet.rs b/examples/create_tweet.rs index b83b0fa..de08bc1 100644 --- a/examples/create_tweet.rs +++ b/examples/create_tweet.rs @@ -53,8 +53,9 @@ async fn main() -> Result<(), Box> { // Wait 60 seconds for processing print!("Waiting for media to finish processing.."); stdout().flush()?; + let mut progress = handle.progress; for ct in 0..=60u32 { - match get_status(handle.id.clone(), &config.token).await?.progress { + match progress { None | Some(ProgressInfo::Success) => { println!("\nMedia sucessfully processed"); break; @@ -69,6 +70,7 @@ async fn main() -> Result<(), Box> { if ct == 60 { Err("Error: timeout")? } + progress = get_status(handle.id.clone(), &config.token).await?.progress; } }