joker-star-l commented on code in PR #44999:
URL: https://github.com/apache/doris/pull/44999#discussion_r1898635267
##########
extension/logstash/lib/logstash/outputs/doris.rb:
##########
@@ -131,22 +132,35 @@ def register
end
end
+ # Run named Timer as daemon thread
+ @timer = java.util.Timer.new("Doris Output #{self.params['id']}", true)
+ # The queue in Timer is unbounded and uncontrollable, so use a new queue
to control the amount
+ @count_block_queue = java.util.concurrent.ArrayBlockingQueue.new(128)
+
+ @retry_queue = Queue.new
+ retry_thread = Thread.new do
+ while popped = @retry_queue.pop
+ documents, http_headers, event_num, req_count = popped
+ handle_request(documents, http_headers, event_num, req_count)
+ end
+ end
+
print_plugin_info()
end # def register
+ def close
+ @timer.cancel
+ end
+
def multi_receive(events)
return if events.empty?
send_events(events)
end
private
def send_events(events)
- documents = ""
- event_num = 0
- events.each do |event|
- documents << event_body(event) << "\n"
- event_num += 1
- end
+ documents = events.map { |event| event_body(event) }.join("\n")
Review Comment:
reduce allocation times
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]