A deferred walk is one whose note says so: a failed first ask is watched as before (review of #200)
This commit is contained in:
@@ -465,12 +465,16 @@ func startedBeside(ctx context.Context, inv *inventory.Inventory, id string, cre
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// deferredNote begins the note of a walk deferred behind another.
|
||||||
|
const deferredNote = "let go; starts once "
|
||||||
|
|
||||||
// deferred says a walk has its word and has not started: let go while another walk was started, it waits for
|
// deferred says a walk has its word and has not started: let go while another walk was started, it waits for
|
||||||
// that one to end (startedBeside). Read as a wait, not as a tier running late: `plans` and `status` say its
|
// that one to end (startedBeside), and its note says so. Read as a wait, not as a tier running late: `plans`
|
||||||
// note, and S3 leaves it out.
|
// and `status` say its note, and S3 leaves it out. A let-go walk whose first ask failed carries that error as
|
||||||
|
// its note instead, and is watched as before.
|
||||||
func deferred(p inventory.Plan) bool {
|
func deferred(p inventory.Plan) bool {
|
||||||
return p.Open() && p.Release == nil && p.Tier == 0 && !askedAny(p) && p.Delivery != nil &&
|
return p.Open() && p.Release == nil && p.Tier == 0 && !askedAny(p) && p.Delivery != nil &&
|
||||||
p.Delivery.Awaits != "" && p.Delivery.Go != nil
|
p.Delivery.Awaits != "" && p.Delivery.Go != nil && strings.HasPrefix(p.Note, deferredNote)
|
||||||
}
|
}
|
||||||
|
|
||||||
// askedAny says a plan asked any module.
|
// askedAny says a plan asked any module.
|
||||||
@@ -621,7 +625,7 @@ func advanceOnce(ctx context.Context, open *stores, p *inventory.Plan,
|
|||||||
if behind, err := startedBeside(ctx, inv, p.ID, p.Created); err != nil {
|
if behind, err := startedBeside(ctx, inv, p.ID, p.Created); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
} else if behind != "" {
|
} else if behind != "" {
|
||||||
note := fmt.Sprintf("let go; starts once %s ended — one walk at a time", behind)
|
note := fmt.Sprintf("%s%s ended — one walk at a time", deferredNote, behind)
|
||||||
changed := p.Note != note
|
changed := p.Note != note
|
||||||
p.Note = note
|
p.Note = note
|
||||||
return changed, nil
|
return changed, nil
|
||||||
|
|||||||
Reference in New Issue
Block a user