Throttle snack notifications

This commit is contained in:
D. Berge
2025-08-12 00:22:09 +02:00
parent 25690eeb52
commit 2a894692ce

View File

@@ -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");
}
}
}