Let's make this sleep time configurable? Ideally we should have something like flush if number of events > N or time since last flush > T.