refactorng, added extra condition into #next_build_from_queue