mod_muc_mam: Skip fetching history if built-in recent history is enough
authorKim Alvefur <zash@zash.se>
Fri, 27 Apr 2018 15:26:29 +0200
changeset 8788 82b889608503
parent 8787 64b78e3deb96
child 8789 adffadd88ff0
mod_muc_mam: Skip fetching history if built-in recent history is enough
plugins/mod_muc_mam.lua
--- a/plugins/mod_muc_mam.lua	Sat Apr 28 00:45:09 2018 +0200
+++ b/plugins/mod_muc_mam.lua	Fri Apr 27 15:26:29 2018 +0200
@@ -254,6 +254,10 @@
 		maxstanzas = get_historylength(room);
 	end
 
+	if room._history and #room._history >= maxstanzas then
+		return -- It can deal with this itself
+	end
+
 	-- Load all the data!
 	local query = {
 		limit = maxstanzas;