a8n: Move "default branch" check to execution of CampaignJob #7725
Labels
batch-changes
Issues related to Batch Changes
estimate/2d
planned/3.13
Issues that were planned for the given milestone. Used by cmd/tracking-issue.
roadmap
Issue tracking a product-eng roadmap item
Milestone
Current state when creating a new CampaignPlan ("Preview changes"):
scopeQuery
yields we create aCampaignJob
CampaignJob
we askgitserver
for its default branchgitserver
cannot determine a default branch the transaction is rolled backHere is the code.
That means the transaction is open for the duration of time it takes to
ask
gitserver
for all default branches.That's not a problem per se, but it is bad UX since it might take a
while until the user sees something after hitting the
"Preview changes"
button.I propose that we move the determination of a
CampaignJob
sBaseRef
and
Rev
out of the transaction and set those when actually running thejob here.
That would require making
rev
andbase_ref
nullable fields in thedatabase and since we have a database unique constraint on
(campaign_plan_id, repo_id, rev)
we have to find out how that workswith
NULL
fields.The upsides:
gitserver
with possibly hundreds of requests in a tight loopCampaignPlan
but instead result in a single erroredCampaignJob
gitserver
anymoreThe text was updated successfully, but these errors were encountered: