Software /
code /
prosody
Diff
plugins/mod_csi_simple.lua @ 9923:e83dfcdeab59
mod_csi_simple: Include queue size in debug messages
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 25 Mar 2019 15:20:28 +0100 (2019-03-25) |
parent | 9922:06bf5ccd859f |
child | 10025:4498f601516d |
line wrap: on
line diff
--- a/plugins/mod_csi_simple.lua Mon Mar 25 10:32:39 2019 +0000 +++ b/plugins/mod_csi_simple.lua Mon Mar 25 15:20:28 2019 +0100 @@ -62,10 +62,10 @@ local function manage_buffer(stanza, session) local ctr = session.csi_counter or 0; if ctr >= queue_size then - session.log("debug", "Queue size limit hit, flushing buffer"); + session.log("debug", "Queue size limit hit, flushing buffer (queue size is %d)", session.csi_counter); 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.log("debug", "Important stanza, flushing buffer (queue size is %d)", session.csi_counter); session.conn:resume_writes(); else stanza = with_timestamp(stanza, jid.join(session.username, session.host)) @@ -75,7 +75,7 @@ end local function flush_buffer(data, session) - session.log("debug", "Client sent something, flushing buffer once"); + session.log("debug", "Client sent something, flushing buffer once (queue size is %d)", session.csi_counter); session.conn:resume_writes(); return data; end @@ -112,9 +112,9 @@ module:hook("c2s-ondrain", function (event) local session = event.session; if session.state == "inactive" and session.conn and session.conn and session.conn.pause_writes then + session.conn:pause_writes(); + session.log("debug", "Buffer flushed, resuming inactive mode (queue size was %d)", session.csi_counter); session.csi_counter = 0; - session.conn:pause_writes(); - session.log("debug", "Buffer flushed, resuming inactive mode"); end end);