eht16 / python-logstash-async

Python logging handler for sending log events asynchronously to Logstash.
MIT License
182 stars 52 forks source link

Makes get_queued_events FIFO or LIFO #84

Closed cbeaujoin-stellar closed 9 months ago

cbeaujoin-stellar commented 1 year ago

Sometime when connectivity brokes it's more interesting to retrieve the fresh data first and not the oldest ones. A simple improvment would be to have choice between LIFO or FIFO in the DatabaseCache.get_queued_events method.

It could be enabled/disabled using a constant, ie: constants.QUEUED_EVENTS_FLUSH_LIFO = True

Call hierarchy is : LogProcessingWorker._fetch_queued_events_for_flush >DatabaseCache.get_queued_events

eht16 commented 1 year ago

Assuming that on subsequent push attempts, all events will be pushed shortly, I don't think it makes a big difference.

Though if you want, create a PR.