Software /
code /
prosody-modules
Changeset
6214:fe9f2c618e8a
mod_push2: option to keep hibernating after first push
author | Stephen Paul Weber <singpolyma@singpolyma.net> |
---|---|
date | Mon, 24 Mar 2025 09:28:25 -0500 |
parents | 6213:811bd0872682 |
children | 6215:e53f0967520c |
files | mod_push2/README.md mod_push2/mod_push2.lua |
diffstat | 2 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_push2/README.md Mon Mar 24 08:53:36 2025 -0500 +++ b/mod_push2/README.md Mon Mar 24 09:28:25 2025 -0500 @@ -16,6 +16,7 @@ ------------------------------------ ----------------- ------------------------------------------------------------------------------------------------------------------- `contact_uri` xmpp:server.tld Contact information for the server operator (usually as a `mailto:` URI is preferred) `push_max_hibernation_timeout` `259200` (72h) Number of seconds to extend the smacks timeout if no push was triggered yet (default: 72 hours) + `hibernate_past_first_push` `true` Keep hibernating using the `push_max_hibernation_timeout` even after first push Internal design notes =====================
--- a/mod_push2/mod_push2.lua Mon Mar 24 08:53:36 2025 -0500 +++ b/mod_push2/mod_push2.lua Mon Mar 24 09:28:25 2025 -0500 @@ -16,6 +16,7 @@ -- configuration local contact_uri = module:get_option_string("contact_uri", "xmpp:" .. module.host) local extended_hibernation_timeout = module:get_option_number("push_max_hibernation_timeout", 72*3600) -- use same timeout like ejabberd +local hibernate_past_first_push = module:get_option_boolean("hibernate_past_first_push", true) local host_sessions = prosody.hosts[module.host].sessions local push2_registrations = module:open_store("push2_registrations", "keyval") @@ -429,7 +430,7 @@ -- if the message was important -- then record the time of first push in the session for the smack module which will extend its hibernation -- timeout based on the value of session.first_hibernated_push - if is_important(stanza, session) then + if is_important(stanza, session) and not hibernate_past_first_push then session.first_hibernated_push = os_time(); -- check for prosody 0.12 mod_smacks if session.hibernating_watchdog and session.original_smacks_callback and session.original_smacks_timeout then