mod_cloud_notify: Fix handling of push_queue
authortmolitor <thilo@eightysoft.de>
Sun, 17 Jan 2021 21:52:36 +0100
changeset 4359 31afa4f314cc
parent 4358 d61d7d30f38d
child 4360 ab2e15d3f1fa
mod_cloud_notify: Fix handling of push_queue smacks-hibernating while the push_queue had a timer running resulted in push not working for this session anymore.
mod_cloud_notify/mod_cloud_notify.lua
--- a/mod_cloud_notify/mod_cloud_notify.lua	Sun Jan 17 18:11:19 2021 +0000
+++ b/mod_cloud_notify/mod_cloud_notify.lua	Sun Jan 17 21:52:36 2021 +0100
@@ -438,7 +438,7 @@
 		if not session.push_queue then session.push_queue = {}; end
 		local queue = session.push_queue;
 		queue[#queue+1] = st.clone(stanza);
-		if #queue == 1 then		-- first stanza --> start timer
+		if not session.awaiting_push_timer then		-- timer not already running --> start new timer
 			session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanza (in a moment)");
 			session.awaiting_push_timer = module:add_timer(1.0, function ()
 				session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanzas (now in timer)");