Fix bug where we would try to dispatch a task immediately even if there are no
available workers. Thanks to Ben who noticed this.