mod_pubsub: Workaround some storage modules without archive key deduplication
authorKim Alvefur <zash@zash.se>
Sun, 08 Oct 2017 21:20:21 +0200
changeset 8305 4852def7dc49
parent 8304 e2ab440a3437
child 8306 053cf683c2c7
mod_pubsub: Workaround some storage modules without archive key deduplication
plugins/mod_pubsub/pubsub.lib.lua
--- a/plugins/mod_pubsub/pubsub.lib.lua	Sun Oct 08 19:42:10 2017 +0200
+++ b/plugins/mod_pubsub/pubsub.lib.lua	Sun Oct 08 21:20:21 2017 +0200
@@ -350,6 +350,9 @@
 		local store = self.store;
 		local data, err = archive:find(user, {
 			key = key;
+			-- Get the last item with that key, if the archive doesn't deduplicate
+			reverse = true,
+			limit = 1;
 		});
 		if not data then
 			module:log("error", "Unable to get item: %s", err);