From b7ab487facc757a9cf6bf6472f0829b7d7bdd792 Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Thu, 21 Jan 2021 20:23:36 +0000 Subject: [PATCH] fixed toast spam #29 --- static-data/www/shared/main/apicheck.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/static-data/www/shared/main/apicheck.js b/static-data/www/shared/main/apicheck.js index 323d4a21..b61f3f41 100644 --- a/static-data/www/shared/main/apicheck.js +++ b/static-data/www/shared/main/apicheck.js @@ -17,10 +17,17 @@ along with this program. If not, see */ apiOnline = true +lastMessageShown = new Date() +everShown = false async function doPing(){ out = setTimeout(function(){ + if (everShown && new Date() - lastMessageShown < 90000){ + return + } + everShown = true if (apiOnline){ - PNotify.notice('Connection lost with API server') + lastMessageShown = new Date() + PNotify.notice('Connection lost with API server') } apiOnline = false }, 10000)