membphis commented on code in PR #12338:
URL: https://github.com/apache/apisix/pull/12338#discussion_r2158076243
##########
apisix/utils/batch-processor-manager.lua:
##########
@@ -85,7 +86,25 @@ do
end
-function _M:add_entry(conf, entry)
+local function total_processed_entries(self)
+ local processed_entries = 0
+ for _, log_buffer in pairs(self.buffers) do
+ processed_entries = processed_entries + log_buffer.processed_entries
+ end
+ return processed_entries
+end
+
+function _M:add_entry(conf, entry, max_pending_entries)
+ if max_pending_entries then
+ local total_processed_entries = total_processed_entries(self)
+ if self.total_pushed_entries - total_processed_entries >
max_pending_entries then
+ core.log.error("max pending entries limit exceeded. discarding entry.",
Review Comment:
bad indentation
<img width="780" alt="image"
src="https://github.com/user-attachments/assets/bf84ffc5-7d7b-483b-8e3e-ca8de5901544"
/>
##########
apisix/utils/batch-processor-manager.lua:
##########
@@ -94,11 +113,22 @@ function _M:add_entry(conf, entry)
end
log_buffer:push(entry)
+ self.total_pushed_entries = self.total_pushed_entries + 1
return true
end
-function _M:add_entry_to_new_processor(conf, entry, ctx, func)
+function _M:add_entry_to_new_processor(conf, entry, ctx, func,
max_pending_entries)
+ if max_pending_entries then
+ local total_processed_entries = total_processed_entries(self)
+ if self.total_pushed_entries - total_processed_entries >
max_pending_entries then
+ core.log.error("max pending entries limit exceeded. discarding entry.",
Review Comment:
ditto
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]