add free_time info

This commit is contained in:
Daniella 2022-10-12 13:22:43 +02:00
parent ff6cb1cdf1
commit 581396c831

View file

@ -228,13 +228,14 @@ async fn send_frames(message: Message, ctx: Context) {
}); });
let mut sa = unix_millis(); let mut sa = unix_millis();
let mut to_compensate_for = 0; let mut to_compensate_for = 0;
let mut free_time = 0;
for mut frame in v.by_ref() { for mut frame in v.by_ref() {
println!("vid: caching"); println!("vid: caching");
let token = token.clone(); let token = token.clone();
let mut frame = tokio::task::spawn_blocking(move || { let mut frame = tokio::task::spawn_blocking(move || {
frame.cache_frame( frame.cache_frame(
n.id.0, n.id.0,
format!("<ProjBotV3 by TudbuT#2624> Image will appear below [to_compensate_for={to_compensate_for}]").as_str(), format!("<ProjBotV3 by TudbuT#2624> Image will appear below [to_compensate_for={to_compensate_for}, free_time={free_time}]").as_str(),
token.as_str(), token.as_str(),
); );
frame frame
@ -306,6 +307,7 @@ async fn send_frames(message: Message, ctx: Context) {
break 'calc; break 'calc;
} }
free_time = to_sleep;
tokio::time::sleep(Duration::from_millis(to_sleep as u64)).await; tokio::time::sleep(Duration::from_millis(to_sleep as u64)).await;
sa = unix_millis(); sa = unix_millis();
println!("vid: completing"); println!("vid: completing");