SetTimeout to pause when waiting for data to ensure that the producer thread has a chance to run