Implemented periodic and configurable flushing of the queue