Diff

plugins/mod_pubsub/pubsub.lib.lua @ 9072:9603a6a1ec85

mod_pubsub: Enforce max_items on insertion
author Kim Alvefur <zash@zash.se>
date Tue, 31 Jul 2018 20:33:58 +0200
parent 9041:b3bc742ee188
child 9076:00d89430d77e
line wrap: on
line diff
--- a/plugins/mod_pubsub/pubsub.lib.lua	Tue Jul 31 15:42:45 2018 +0100
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Tue Jul 31 20:33:58 2018 +0200
@@ -746,6 +746,10 @@
 		else
 			data, err = archive:delete(user, { key = key; });
 		end
+		-- TODO archive support for maintaining maximum items
+		archive:delete(user, {
+			truncate = max_items;
+		});
 		if not data then
 			module:log("error", "Unable to set item: %s", err);
 			return nil, err;