Changeset

2042:752eee154891

mod_mam: Add some debug logging
author Kim Alvefur <zash@zash.se>
date Thu, 04 Feb 2016 13:38:06 +0100
parents 2041:7c61ab512d0b
children 2043:4ad3f25ab004
files mod_mam/mod_mam.lua
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_mam/mod_mam.lua	Tue Feb 02 16:28:12 2016 +0100
+++ b/mod_mam/mod_mam.lua	Thu Feb 04 13:38:06 2016 +0100
@@ -284,6 +284,8 @@
 
 	cleanup_after = tonumber(n) * ( multipliers[m] or 1 );
 
+	module:log("debug", "archive_expires_after = %d -- in seconds", cleanup_after);
+
 	if not archive.delete then
 		module:log("error", "archive_expires_after set but mod_%s does not support deleting", archive._provided_by);
 		return false;
@@ -305,6 +307,11 @@
 			local ok, err = archive:delete(user, { ["end"] = os.time() - cleanup_after; })
 			if not ok then
 				module:log("warn", "Could not expire archives for user %s: %s", user, err);
+			else
+				-- :affected() is a recent addition for eg SQLite3 in LuaDBI
+				pcall(function(stmt)
+					module:log("debug", "Removed %d messages", stmt:affected());
+				end, err);
 			end
 			cleanup[user] = nil;
 		end