Comparison

plugins/mod_csi_simple.lua @ 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
parent 9920:4a56d7891bd3
child 9922:06bf5ccd859f
comparison
equal deleted inserted replaced
9920:4a56d7891bd3 9921:ec138e4254ed
59 return stanza; 59 return stanza;
60 end 60 end
61 61
62 local function manage_buffer(stanza, session) 62 local function manage_buffer(stanza, session)
63 local ctr = session.csi_counter or 0; 63 local ctr = session.csi_counter or 0;
64 if ctr >= queue_size or module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then 64 if ctr >= queue_size then
65 session.log("debug", "Queue size limit hit, flushing buffer");
66 session.conn:resume_writes();
67 elseif module:fire_event("csi-is-stanza-important", { stanza = stanza, session = session }) then
68 session.log("debug", "Important stanza, flushing buffer");
65 session.conn:resume_writes(); 69 session.conn:resume_writes();
66 else 70 else
67 stanza = with_timestamp(stanza, jid.join(session.username, session.host)) 71 stanza = with_timestamp(stanza, jid.join(session.username, session.host))
68 end 72 end
69 session.csi_counter = ctr + 1; 73 session.csi_counter = ctr + 1;