Skip to content

Commit

Permalink
fix(terminal): repeat retry screen instruction sending during stdin c…
Browse files Browse the repository at this point in the history
…ache replay (zellij-org#3372)
  • Loading branch information
manueldeprada authored Aug 13, 2024
1 parent affbd92 commit 64a1cbc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion zellij-server/src/route.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::collections::{BTreeMap, HashSet, VecDeque};
use std::sync::{Arc, RwLock};
use std::thread;
use std::time::Duration;

use crate::thread_bus::ThreadSenders;
use crate::{
Expand Down Expand Up @@ -1222,13 +1224,17 @@ pub(crate) fn route_thread_main(
}
Ok(should_break)
};
let mut repeat_retries = VecDeque::new();
while let Some(instruction_to_retry) = retry_queue.pop_front() {
log::warn!("Server ready, retrying sending instruction.");
let should_break = handle_instruction(instruction_to_retry, None)?;
thread::sleep(Duration::from_millis(100));
let should_break = handle_instruction(instruction_to_retry, Some(&mut repeat_retries))?;
if should_break {
break 'route_loop;
}
}
// retry on loop around
retry_queue.append(&mut repeat_retries);
let should_break = handle_instruction(instruction, Some(&mut retry_queue))?;
if should_break {
break 'route_loop;
Expand Down

0 comments on commit 64a1cbc

Please sign in to comment.