# HG changeset patch # User tmolitor # Date 1611987453 -3600 # Node ID e5493a10c4d1e3bc94318d35cf917eadac02caaa # Parent c3d21182ebf3714ad048b8bd7339ad975bc980ac mod_cloud_notify: use stanza from mod_smacks to behave O(1) This uses the provided stanza in the ack-delayed smacks event to trigger push for this stanza only rather than iterating through the whole smacks queue to find the first unpushed stanza. diff -r c3d21182ebf3 -r e5493a10c4d1 mod_cloud_notify/mod_cloud_notify.lua --- a/mod_cloud_notify/mod_cloud_notify.lua Sat Jan 30 01:10:06 2021 +0100 +++ b/mod_cloud_notify/mod_cloud_notify.lua Sat Jan 30 07:17:33 2021 +0100 @@ -476,7 +476,10 @@ local function restore_session(event) local session = event.resumed; if session then -- older smacks module versions send only the "intermediate" session in event.session and no session.resumed one - if session.awaiting_push_timer then session.awaiting_push_timer:stop(); end + if session.awaiting_push_timer then + session.awaiting_push_timer:stop(); + session.awaiting_push_timer = nil; + end session.first_hibernated_push = nil; end end @@ -485,7 +488,9 @@ local function ack_delayed(event) local session = event.origin; local queue = event.queue; + local stanza = event.stanza; if not session.push_identifier then return; end + if stanza then process_stanza(session, stanza); return; end -- don't iterate through smacks queue if we know which stanza triggered this for i=1, #queue do local stanza = queue[i]; -- process unacked stanzas (handle_notify_request() will only send push requests for new stanzas)