changeset 2513:66a61f48e376

mod_mam: Add comments
author Kim Alvefur <zash@zash.se>
date Mon, 20 Feb 2017 00:09:45 +0100
parents bc7539ccbde1
children d47a7e6e9adc
files mod_mam/mod_mam.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Mon Feb 20 00:48:31 2017 +0100
+++ b/mod_mam/mod_mam.lua	Mon Feb 20 00:09:45 2017 +0100
@@ -320,14 +320,20 @@
 		return false;
 	end
 
+	-- Set of known users to do message expiry for
+	-- Populated either below or when new messages are added
 	cleanup = {};
 
+	-- Iterating over users is not supported by all authentication modules
+	-- Catch and ignore error if not supported
 	pcall(function ()
+		-- If this works, then we schedule cleanup for all known users on startup
 		for user in um.users(module.host) do
 			cleanup[user] = true;
 		end
 	end);
 
+	-- At odd intervals, delete old messages for one user
 	module:add_timer(math.random(10, 60), function()
 		local user = next(cleanup);
 		if user then