flush the buffer every 1 second