diff options
author | Matthew Wild <mwild1@gmail.com> | 2024-11-21 17:02:55 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2024-11-21 17:02:55 +0000 |
commit | 9de5f1149bd8ad2e0d6c1022d1c8eb0b1ac5cc13 (patch) | |
tree | 9006ca9dc4f8ddaccc2412c84e010e1bafbe5457 /plugins | |
parent | 6bbfcd801a6f5b9aa1150fe583b3c9db2c8a2cfc (diff) | |
download | prosody-origin/master.tar.gz prosody-origin/master.zip |
mod_smacks: Run session destruction code in session's async contextHEADorigin/mastermaster
This is the Right Thing and should fix various potential issues and race
conditions.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_smacks.lua | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/mod_smacks.lua b/plugins/mod_smacks.lua index 2b131031..65d410e0 100644 --- a/plugins/mod_smacks.lua +++ b/plugins/mod_smacks.lua @@ -541,13 +541,17 @@ module:hook("pre-resource-unbind", function (event) return end - prosody.main_thread:run(function () - session.log("debug", "Destroying session for hibernating too long"); - save_old_session(session); - session.resumption_token = nil; - sessionmanager.destroy_session(session, "Hibernating too long"); - sessions_expired(1); - end); + session.thread:run({ + event = "callback"; + name = "mod_smacks/destroy_hibernating"; + callback = function () + session.log("debug", "Destroying session for hibernating too long"); + save_old_session(session); + session.resumption_token = nil; + sessionmanager.destroy_session(session, "Hibernating too long"); + sessions_expired(1); + end; + }); end); if session.conn then local conn = session.conn; |