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.
FIFO (current) :
query_fetch = '''
SELECT `event_id`, `event_text` FROM `event` WHERE `pending_delete` = 0 LIMIT ?;'''
LIFO (should be):
query_fetch = '''
SELECT `event_id`, `event_text` FROM `event` WHERE `pending_delete` = 0 ORDER BY `event_id` DESC LIMIT ?;'''
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
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.
FIFO (current) :
LIFO (should be):
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