diff options
-rw-r--r-- | plugins/mod_smacks.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index e0a7bbfb..292b7e0b 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -494,14 +494,16 @@ module:hook("pre-resource-unbind", function (event) return end - session.log("debug", "Destroying session for hibernating too long"); - session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; - old_session_registry:set(session.username, session.resumption_token, - { h = session.handled_stanza_count; t = os.time() }); - session.resumption_token = nil; - session.resending_unacked = true; -- stop outgoing_stanza_filter from re-queueing anything anymore - sessionmanager.destroy_session(session, "Hibernating too long"); - sessions_expired(1); + prosody.main_thread:run(function () + session.log("debug", "Destroying session for hibernating too long"); + session_registry[jid.join(session.username, session.host, session.resumption_token)] = nil; + old_session_registry:set(session.username, session.resumption_token, + { h = session.handled_stanza_count; t = os.time() }); + session.resumption_token = nil; + session.resending_unacked = true; -- stop outgoing_stanza_filter from re-queueing anything anymore + sessionmanager.destroy_session(session, "Hibernating too long"); + sessions_expired(1); + end); end); if session.conn then local conn = session.conn; |