comparison mod_cloud_notify/mod_cloud_notify.lua @ 4355:31afa4f314cc

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.
author tmolitor <thilo@eightysoft.de>
date Sun, 17 Jan 2021 21:52:36 +0100
parents 7a5ca4b285cb
children 33f82988d7a9
comparison
equal deleted inserted replaced
4354:d61d7d30f38d 4355:31afa4f314cc
436 if session.push_identifier then 436 if session.push_identifier then
437 session.log("debug", "adding new stanza to push_queue"); 437 session.log("debug", "adding new stanza to push_queue");
438 if not session.push_queue then session.push_queue = {}; end 438 if not session.push_queue then session.push_queue = {}; end
439 local queue = session.push_queue; 439 local queue = session.push_queue;
440 queue[#queue+1] = st.clone(stanza); 440 queue[#queue+1] = st.clone(stanza);
441 if #queue == 1 then -- first stanza --> start timer 441 if not session.awaiting_push_timer then -- timer not already running --> start new timer
442 session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanza (in a moment)"); 442 session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanza (in a moment)");
443 session.awaiting_push_timer = module:add_timer(1.0, function () 443 session.awaiting_push_timer = module:add_timer(1.0, function ()
444 session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanzas (now in timer)"); 444 session.log("debug", "Invoking cloud handle_notify_request() for newly smacks queued stanzas (now in timer)");
445 process_stanza_queue(session.push_queue, session, "push"); 445 process_stanza_queue(session.push_queue, session, "push");
446 session.push_queue = {}; -- clean up queue after push 446 session.push_queue = {}; -- clean up queue after push