From f968736a4eb953a2e086c867a0524e185ae50dba Mon Sep 17 00:00:00 2001 From: Manuel de Prada Corral <6536835+manueldeprada@users.noreply.github.com> Date: Wed, 16 Oct 2024 09:00:41 +0200 Subject: [PATCH] fix(client): repeat retry screen instruction (#3570) --- zellij-server/src/route.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs index 2580a12d..b0f5cce6 100644 --- a/zellij-server/src/route.rs +++ b/zellij-server/src/route.rs @@ -10,6 +10,8 @@ use crate::{ screen::ScreenInstruction, ServerInstruction, SessionMetaData, SessionState, }; +use std::thread; +use std::time::Duration; use uuid::Uuid; use zellij_utils::{ channels::SenderWithContext, @@ -1220,13 +1222,18 @@ 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(5)); + 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;