# HG changeset patch # User Stephen Paul Weber # Date 1742826505 18000 # Node ID fe9f2c618e8a5b2e56b33d415db970c342f7edc8 # Parent 811bd0872682b14739c551c83888487ec71bf458 mod_push2: option to keep hibernating after first push diff -r 811bd0872682 -r fe9f2c618e8a mod_push2/README.md --- 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 ===================== diff -r 811bd0872682 -r fe9f2c618e8a mod_push2/mod_push2.lua --- 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