Hold a node from composing to sending, so a push composed before converge or adopt is never sent after it (hq ADR 0100)

This commit is contained in:
2026-09-22 18:10:04 +02:00
parent 1eff586a40
commit 689c2c6d33
6 changed files with 220 additions and 4 deletions
+16
View File
@@ -152,6 +152,16 @@ func converge(ctx context.Context, open *stores, node string, yes bool, digest s
if filter == "" {
filter = DefaultFilter
}
if yes {
// Held from the checks to the send, so no push composed before the flip is sent after it
// and returns the node to adopted.
held, release, err := holdNodes(ctx, open, []string{node})
if err != nil {
return "", err
}
defer release()
ctx = held
}
record, err := inv.NodeByName(ctx, node)
if err != nil {
return "", err
@@ -435,6 +445,12 @@ func adopt(ctx context.Context, open *stores, node string) (string, error) {
if record.Adopted {
return "", fmt.Errorf("%s is adopted already", node)
}
held, release, err := holdNodes(ctx, open, []string{node})
if err != nil {
return "", err
}
defer release()
ctx = held
if err := inv.SetAdopted(ctx, node, true); err != nil {
return "", err
}