Changeset

12135:fa804c2db747

mod_smacks: Record timestamp with persisted counters For future cleanup routine when people inevitably complain about this data being stored there forever
author Kim Alvefur <zash@zash.se>
date Fri, 31 Dec 2021 00:18:13 +0100
parents 12134:912614c4bf3e
children 12136:6366240d2edb
files plugins/mod_smacks.lua
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_smacks.lua	Wed Dec 29 18:03:26 2021 +0100
+++ b/plugins/mod_smacks.lua	Fri Dec 31 00:18:13 2021 +0100
@@ -467,7 +467,8 @@
 
 		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 });
+		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");
@@ -681,7 +682,8 @@
 	for _, user in pairs(local_sessions) do
 		for _, session in pairs(user.sessions) do
 			if session.resumption_token then
-				if old_session_registry:set(session.username, session.resumption_token, { h = session.handled_stanza_count }) then
+				if old_session_registry:set(session.username, session.resumption_token,
+					{ h = session.handled_stanza_count; t = os.time() }) then
 					session.resumption_token = nil;
 
 					-- Deal with unacked stanzas