Add funtion for check if there is any idle worker and also add a wait for idle worker.