diff options
author | Mario <mario@mariovavti.com> | 2024-07-17 14:34:46 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2024-07-17 14:34:46 +0000 |
commit | 2cfdbbd956c510071b57a776b38580a2b5971cc7 (patch) | |
tree | 9a59aed092258b7095cb17c226fe089aab23c3e0 | |
parent | 5f66ad5bc593602153c037d42c25c70139185ab1 (diff) | |
download | volse-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
-rw-r--r-- | boot.php | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -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; |