Diff

plugins/mod_mam/mod_mam.lua @ 8133:102e1ec8bee1

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 26 Apr 2017 11:55:27 +0200
parent 8132:6ddddfe05a74
child 8137:484ea6201c6c
line wrap: on
line diff
--- a/plugins/mod_mam/mod_mam.lua	Tue Apr 25 01:42:59 2017 +0200
+++ b/plugins/mod_mam/mod_mam.lua	Wed Apr 26 11:55:27 2017 +0200
@@ -52,6 +52,8 @@
 	archive = module:require "fallback_archive";
 end
 
+local use_total = true;
+
 local cleanup;
 
 -- Handle prefs.
@@ -137,7 +139,7 @@
 		limit = qmax + 1;
 		before = before; after = after;
 		reverse = reverse;
-		total = true;
+		total = get_total;
 	});
 
 	if not data then
@@ -359,6 +361,10 @@
 		end
 		return math.random(cleanup_interval, cleanup_interval * 2);
 	end);
+else
+	-- Don't ask the backend to count the potentially unbounded number of items,
+	-- it'll get slow.
+	use_total = false;
 end
 
 -- Stanzas sent by local clients