Skip to content

Stop BBM early when no more jobs

The following discussion from !1652 (merged) should be addressed:

  • @jaime started a discussion: (+2 comments)

    thought: I'm thinking if we should consider a scenario where there are no pending jobs at all. The worker could potentially be shut down safely until next registry restart since the schema migrations will be applied at startup.

    Unless the new registry version requires the BM to be present, in which case this is not valid 🤔

@suleimiahmed : Background migrations can potentially be paused/failed (meaning there are no pending jobs for the migrations) and then become active via a CLI command triggered by a user at a later time. This means that the state of the background migration and eventually its jobs can change to active while the registry is serving traffic (without stopping registry instances). if this were to happen we would miss this new BBM state and not schedule new jobs until the registry instances are restarted.

While another option is to shutdown the bbm process if all migrations are in the completed state, we could potentially leave that as an optimization on the first iteration after getting some feedback from our first bbm run, WDYT?