mod_pubsub: Enforce max_items on insertion
authorKim Alvefur <zash@zash.se>
Tue, 31 Jul 2018 20:33:58 +0200
changeset 9075 9603a6a1ec85
parent 9074 db61e33bbd41
child 9076 a5daf3f6d588
mod_pubsub: Enforce max_items on insertion
plugins/mod_pubsub/pubsub.lib.lua
--- 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;