From 20d3403a84f1fe42f6dfcc1bbe80ede8432e8f85 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 19 Jul 2021 17:07:59 +0200 Subject: MUC: Skip adding to history when it's set to zero Optimizes away all the processing on every message in case the end-result is zero history. --- plugins/muc/history.lib.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'plugins/muc') diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua index fdf65365..075b1890 100644 --- a/plugins/muc/history.lib.lua +++ b/plugins/muc/history.lib.lua @@ -173,6 +173,10 @@ end, 50); -- Before subject(20) -- add to history module:hook("muc-add-history", function(event) local room = event.room + if get_historylength(room) == 0 then + room._history = nil; + return; + end local history = room._history; if not history then history = {}; room._history = history; end local stanza = st.clone(event.stanza); -- cgit v1.2.3