Changeset

9072:9603a6a1ec85

mod_pubsub: Enforce max_items on insertion
author Kim Alvefur <zash@zash.se>
date Tue, 31 Jul 2018 20:33:58 +0200
parents 9071:db61e33bbd41
children 9073:a5daf3f6d588
files plugins/mod_pubsub/pubsub.lib.lua
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
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;