From 61d83bcbed1ee0e1bbcaf5b815ad5de897fc7929 Mon Sep 17 00:00:00 2001 From: Adrian Salceanu Date: Wed, 23 Oct 2024 18:48:20 +0200 Subject: [PATCH] Improve keepalive logic --- Project.toml | 2 +- assets/js/keepalive.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 4237bded..a8b3dba4 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Stipple" uuid = "4acbeb90-81a0-11ea-1966-bdaff8155998" authors = ["Adrian and the Stipple contributors"] -version = "0.28.14" +version = "0.28.15" [deps] Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" diff --git a/assets/js/keepalive.js b/assets/js/keepalive.js index 8af9f525..24b68f90 100644 --- a/assets/js/keepalive.js +++ b/assets/js/keepalive.js @@ -5,8 +5,10 @@ */ function keepalive() { - if (Date.now() - _lastMessageAt < Genie.Settings.webchannels_keepalive_frequency) { - return + if (window._lastMessageAt !== undefined) { + if (Date.now() - window._lastMessageAt < Genie.Settings.webchannels_keepalive_frequency) { + return + } } if (Genie.Settings.env == 'dev') {