H-A-146: the bound before a failed resolution is asked again is the setting resolve-again-minutes
A failed resolution of a want's version, or one forgotten after a failed fetch, stood a minute written into the code; by principle 11 a bound is a setting with a default. The manifest declares resolve-again-minutes (1 to 60, default 1) and its file, the engine reads it at its start and hands it to the composer's Env. Builds: design 47 H H-A-146 (hq 26f5505e), principle 11
This commit is contained in:
@@ -25,8 +25,17 @@ import (
|
||||
// manifest's `from` pins. A want that names parts (a build no version is known of) is read by its parts as before. A lookup that
|
||||
// fails is said in the journal, naming the module, the version and the seat, and the module is held whole: never composed partly.
|
||||
|
||||
// resolveAgain is how long a failed lookup stands before it is asked again; a pass is asked then.
|
||||
const resolveAgain = time.Minute
|
||||
// DefaultResolveAgain is how long a failed lookup stands before it is asked again when the setting `resolve-again-minutes` gives
|
||||
// nothing (Env.ResolveAgain 0); a pass is asked then (H-A-146 "after a bound"; principle 11: a bound is a setting with a default).
|
||||
const DefaultResolveAgain = time.Minute
|
||||
|
||||
// resolveAgain is how long a failed lookup stands before it is asked again: the setting, or DefaultResolveAgain.
|
||||
func (c *Composer) resolveAgain() time.Duration {
|
||||
if c.env.ResolveAgain > 0 {
|
||||
return c.env.ResolveAgain
|
||||
}
|
||||
return DefaultResolveAgain
|
||||
}
|
||||
|
||||
// versionsVerb is the verb a lookup asks.
|
||||
const versionsVerb = "versions"
|
||||
@@ -107,7 +116,7 @@ func (c *Composer) resolve(module string, e meshcatalog.CatalogEntry, w meshwant
|
||||
c.mu.Lock()
|
||||
r, ok := c.resolved[key]
|
||||
c.mu.Unlock()
|
||||
if ok && (r.failed == "" || now.Sub(r.at) < resolveAgain) {
|
||||
if ok && (r.failed == "" || now.Sub(r.at) < c.resolveAgain()) {
|
||||
return r.parts, r.failed
|
||||
}
|
||||
parts, failed := c.lookUp(module, e, w)
|
||||
@@ -124,7 +133,7 @@ func (c *Composer) resolve(module string, e meshcatalog.CatalogEntry, w meshwant
|
||||
c.resolved[key] = versionParts{parts: parts, failed: failed, at: now}
|
||||
c.mu.Unlock()
|
||||
if failed != "" {
|
||||
time.AfterFunc(resolveAgain, c.askRehand)
|
||||
time.AfterFunc(c.resolveAgain(), c.askRehand)
|
||||
return nil, failed
|
||||
}
|
||||
return parts, ""
|
||||
@@ -146,7 +155,7 @@ func (c *Composer) forgetFetched(digest, why string) {
|
||||
continue
|
||||
}
|
||||
line := fmt.Sprintf("resolution of %s %s forgotten: %s", k.module, k.version, why)
|
||||
c.resolved[k] = versionParts{failed: line + "; the seats' verb versions is asked again at its next want, at the next compose or in " + resolveAgain.String(),
|
||||
c.resolved[k] = versionParts{failed: line + "; the seats' verb versions is asked again at its next want, at the next compose or in " + c.resolveAgain().String(),
|
||||
at: now, forgotten: true}
|
||||
lines = append(lines, line)
|
||||
}
|
||||
@@ -156,7 +165,7 @@ func (c *Composer) forgetFetched(digest, why string) {
|
||||
c.env.Say(line)
|
||||
}
|
||||
if len(lines) > 0 {
|
||||
time.AfterFunc(resolveAgain, c.askRehand)
|
||||
time.AfterFunc(c.resolveAgain(), c.askRehand)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user