From 2a894692ce0614ca01bfe6f16e4ee052c54fdab0 Mon Sep 17 00:00:00 2001 From: "D. Berge" Date: Tue, 12 Aug 2025 00:22:09 +0200 Subject: [PATCH] Throttle snack notifications --- lib/www/client/source/src/components/footer.vue | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/www/client/source/src/components/footer.vue b/lib/www/client/source/src/components/footer.vue index 7a4a32d..e1016fd 100644 --- a/lib/www/client/source/src/components/footer.vue +++ b/lib/www/client/source/src/components/footer.vue @@ -60,6 +60,13 @@ export default { DougalNotificationsControl }, + data () { + return { + lastGatewayErrorTimestamp: 0, + gatewayErrorSilencePeriod: 60000, + } + }, + computed: { year () { const date = new Date(); @@ -77,7 +84,11 @@ export default { isGatewayReliable (val) { if (val === false) { - this.$root.showSnack("Gateway error", "warning"); + const elapsed = Date.now() - this.lastGatewayErrorTimestamp; + const lastGatewayErrorTimestamp = Date.now(); + if (elapsed > this.gatewayErrorSilencePeriod) { + this.$root.showSnack("Gateway error", "warning"); + } } }