fix(deployment): detach each instance's settled rows from the bulk deploy's shared unit of work after Finalize (review 2026-10-21 04/M3)
This commit is contained in:
+21
@@ -844,6 +844,27 @@ public class DeploymentManagerRepository : IDeploymentManagerRepository
|
||||
return pending.Count;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public int DetachSettledDeploymentRows(int instanceId)
|
||||
{
|
||||
// Enumerated into a list first: changing State mutates the tracker.
|
||||
var settled = _dbContext.ChangeTracker.Entries()
|
||||
.Where(e => e.State == EntityState.Unchanged
|
||||
&& e.Entity switch
|
||||
{
|
||||
PendingDeployment p => p.InstanceId == instanceId,
|
||||
DeployedConfigSnapshot s => s.InstanceId == instanceId,
|
||||
DeploymentRecord r => r.InstanceId == instanceId,
|
||||
_ => false
|
||||
})
|
||||
.ToList();
|
||||
|
||||
foreach (var entry in settled)
|
||||
entry.State = EntityState.Detached;
|
||||
|
||||
return settled.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flat shape of the deployment-record ⋈ instance join used to compose the list
|
||||
/// query. A named type rather than an anonymous one so
|
||||
|
||||
Reference in New Issue
Block a user