fixed toast spam #29

This commit is contained in:
Kevin Froman 2021-01-21 20:23:36 +00:00
parent 5a9594074e
commit b7ab487fac
1 changed files with 8 additions and 1 deletions

View File

@ -17,10 +17,17 @@
along with this program. If not, see <https://www.gnu.org/licenses/> along with this program. If not, see <https://www.gnu.org/licenses/>
*/ */
apiOnline = true apiOnline = true
lastMessageShown = new Date()
everShown = false
async function doPing(){ async function doPing(){
out = setTimeout(function(){ out = setTimeout(function(){
if (everShown && new Date() - lastMessageShown < 90000){
return
}
everShown = true
if (apiOnline){ if (apiOnline){
PNotify.notice('Connection lost with API server') lastMessageShown = new Date()
PNotify.notice('Connection lost with API server')
} }
apiOnline = false apiOnline = false
}, 10000) }, 10000)