Skip to content

Close changesets in background

Administrator requested to merge mrn/close-changesets-background into main

Created by: mrnugget

This fixes #13367 by moving the closing of changesets out of the request path (when applying a campaign spec or closing a campaign) and into the background, into the reconciler.

It does so by introducing yet another boolean flag on the changesets table called closing, which is set to true along with reconciler_state to 'queued' when the changeset should be closed.

Just like in #13288 I couldn't see a way to avoid that boolean that doesn't introduce another edge case somewhere else.

One option would be, for example, to add a closed: Boolean to the ChangesetSpec schema (which we don't have to expose to the users, but which could allow users to close single changesets) and then set that. Problem is: our ChangesetSpecs are immutable right now. When you want to change one, you need a new one and apply that. So if I want to keep that immutability (which seems like a nice property to preserve) I'd have to create a new ChangesetSpec when I want to close the changeset and (here's the kicker) a new CampaignSpec to which to attach it... Then I'd have to somehow apply that along with all the other changeset specs, etc.

I still think there might be a way to make this idea of "we now want to change the state, internally. reconciler, make it happen" flow better through the system, where "unsynced" and "closing" might be combined, but I haven't found it yet. If you have better ideas: let me know!

Merge request reports

Loading