From ac1733c46ebfdadf4be1707b46a983d346182502 Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sat, 12 Aug 2023 15:16:37 -0400 Subject: [PATCH] #314 20s grace period for coordinator render to finish to prevent timeouts --- supervisor/session/coordinator.lua | 14 +++++++++++++- supervisor/startup.lua | 2 +- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/supervisor/session/coordinator.lua b/supervisor/session/coordinator.lua index 98b7431..c2d20cd 100644 --- a/supervisor/session/coordinator.lua +++ b/supervisor/session/coordinator.lua @@ -17,6 +17,9 @@ local FAC_COMMAND = comms.FAC_COMMAND local SV_Q_DATA = svqtypes.SV_Q_DATA +-- grace period in seconds for coordinator to finish UI draw to prevent timeout +local WATCHDOG_GRACE = 20.0 + -- retry time constants in ms -- local INITIAL_WAIT = 1500 local RETRY_PERIOD = 1000 @@ -61,6 +64,7 @@ function coordinator.new_session(id, s_addr, in_queue, out_queue, timeout, facil r_seq_num = nil, connected = true, conn_watchdog = util.new_watchdog(timeout), + establish_time = util.time_s(), last_rtt = 0, -- periodic messages periodics = { @@ -354,7 +358,15 @@ function coordinator.new_session(id, s_addr, in_queue, out_queue, timeout, facil -- check if a timer matches this session's watchdog ---@nodiscard function public.check_wd(timer) - return self.conn_watchdog.is_timer(timer) and self.connected + local is_wd = self.conn_watchdog.is_timer(timer) and self.connected + + -- if we are waiting for initial coordinator UI draw, don't close yet + if is_wd and (util.time_s() - self.establish_time) <= WATCHDOG_GRACE then + self.conn_watchdog.feed() + is_wd = false + end + + return is_wd end -- close the connection diff --git a/supervisor/startup.lua b/supervisor/startup.lua index 59f5c4f..1ba2a4f 100644 --- a/supervisor/startup.lua +++ b/supervisor/startup.lua @@ -21,7 +21,7 @@ local supervisor = require("supervisor.supervisor") local svsessions = require("supervisor.session.svsessions") -local SUPERVISOR_VERSION = "v0.20.4" +local SUPERVISOR_VERSION = "v0.20.5" local println = util.println local println_ts = util.println_ts