diff --git a/module_build_service/scheduler/producer.py b/module_build_service/scheduler/producer.py index 1c7bc7e..6683ed3 100644 --- a/module_build_service/scheduler/producer.py +++ b/module_build_service/scheduler/producer.py @@ -285,6 +285,18 @@ class MBSProducer(PollingProducer): further_work = module_build_service.utils.start_next_batch_build( config, module_build, session, builder) + + if not further_work: + # The module is done, still in the build state. + # The newrepo already finished, but we missed a message (or something) + # and don't want the module do t + state_reason = 'The module was in the build state with no work to do' + module_build.transition( + config, + state=models.BUILD_STATES['done'], + state_reason=state_reason, + ) + for event in further_work: log.info(" Scheduling faked event %r" % event) module_build_service.scheduler.consumer.work_queue_put(event)