Changeset

9921:ec138e4254ed

mod_csi_simple: Improve debug logs by mentioing why the buffer gets flushed
author Kim Alvefur <zash@zash.se>
date Sun, 24 Mar 2019 22:01:36 +0100
parents 9920:4a56d7891bd3
children 9922:06bf5ccd859f
files plugins/mod_csi_simple.lua
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua	Sun Mar 24 20:53:49 2019 +0100
+++ b/plugins/mod_csi_simple.lua	Sun Mar 24 22:01:36 2019 +0100
@@ -61,7 +61,11 @@
 
 local function manage_buffer(stanza, session)
 	local ctr = session.csi_counter or 0;
-	if ctr >= queue_size or module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
+	if ctr >= queue_size then
+		session.log("debug", "Queue size limit hit, flushing buffer");
+		session.conn:resume_writes();
+	elseif module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
+		session.log("debug", "Important stanza, flushing buffer");
 		session.conn:resume_writes();
 	else
 		stanza = with_timestamp(stanza, jid.join(session.username, session.host))