aboutsummaryrefslogtreecommitdiffstats
path: root/boot.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-07-17 14:34:46 +0000
committerMario <mario@mariovavti.com>2024-07-17 14:34:46 +0000
commit2cfdbbd956c510071b57a776b38580a2b5971cc7 (patch)
tree9a59aed092258b7095cb17c226fe089aab23c3e0 /boot.php
parent5f66ad5bc593602153c037d42c25c70139185ab1 (diff)
downloadvolse-hubzilla-2cfdbbd956c510071b57a776b38580a2b5971cc7.tar.gz
volse-hubzilla-2cfdbbd956c510071b57a776b38580a2b5971cc7.tar.bz2
volse-hubzilla-2cfdbbd956c510071b57a776b38580a2b5971cc7.zip
sse: revert removing of reset after 30 seconds and save a db lookup if we have just reset
Diffstat (limited to 'boot.php')
-rw-r--r--boot.php26
1 files changed, 24 insertions, 2 deletions
diff --git a/boot.php b/boot.php
index 3e07bcaaf..b20acb18f 100644
--- a/boot.php
+++ b/boot.php
@@ -1928,7 +1928,18 @@ function notice($s) {
}
}
- $x = get_xconfig($hash, 'sse', 'notifications', []);
+ $x = null;
+
+ $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE);
+
+ if (datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
+ set_xconfig($hash, 'sse', 'notifications', []);
+ $x = [];
+ }
+
+ if ($x === null) {
+ $x = get_xconfig($hash, 'sse', 'notifications', []);
+ }
if (isset($x['notice']) && in_array($s, $x['notice']['notifications'])) {
return;
@@ -1980,7 +1991,18 @@ function info($s) {
}
}
- $x = get_xconfig($hash, 'sse', 'notifications', []);
+ $x = null;
+
+ $t = get_xconfig($hash, 'sse', 'timestamp', NULL_DATE);
+
+ if (datetime_convert('UTC', 'UTC', $t) < datetime_convert('UTC', 'UTC', '- 30 seconds')) {
+ set_xconfig($hash, 'sse', 'notifications', []);
+ $x = [];
+ }
+
+ if ($x === null) {
+ $x = get_xconfig($hash, 'sse', 'notifications', []);
+ }
if (isset($x['info']) && in_array($s, $x['info']['notifications'])) {
return;