comparison plugins/mod_csi_simple.lua @ 11928:16cf863b36c0

mod_csi_simple: Skip initiating flush in all but inactive state Both in the flushing and active states the right thing to do is skip directly to returning the data. Also in any unknown state, like if the filter is somehow left behind on module unload.
author Kim Alvefur <zash@zash.se>
date Sat, 20 Nov 2021 23:54:43 +0100
parents 4d63d8ef1cf9
children 1c47162dd965
comparison
equal deleted inserted replaced
11927:4d63d8ef1cf9 11928:16cf863b36c0
141 return stanza; 141 return stanza;
142 end 142 end
143 143
144 local function flush_buffer(data, session) 144 local function flush_buffer(data, session)
145 local ctr = session.csi_counter or 0; 145 local ctr = session.csi_counter or 0;
146 if ctr == 0 or session.state == "flushing" then return data end 146 if ctr == 0 or session.state ~= "inactive" then return data end
147 session.log("debug", "Flushing buffer (%s; queue size is %d)", "client activity", session.csi_counter); 147 session.log("debug", "Flushing buffer (%s; queue size is %d)", "client activity", session.csi_counter);
148 session.state = "flushing"; 148 session.state = "flushing";
149 module:fire_event("csi-flushing", { session = session }); 149 module:fire_event("csi-flushing", { session = session });
150 flush_reasons:with_labels("client activity"):add(1); 150 flush_reasons:with_labels("client activity"):add(1);
151 if session.csi_measure_buffer_hold then 151 if session.csi_measure_buffer_hold then