Add maxVolatileTime para to control data provider flush interval and little refactors