add timer to trigger flush