selfcompose: ask a trunk build the catalog gave none of again on a backoff or a catalog-revision, not at every pass
A trunk build answered none waits laterAgain's step for its module (5 s growing to 5 min); the seat mesh-catalog's event catalog-revision, heard through Env.Hear, ends the wait of every module at once; an answer starts the steps again. A pass is woken at the step's end. Builds: design 47 G-22 A-487a, A-461e, G-12 line 317
This commit is contained in:
@@ -161,6 +161,10 @@ type SeatGate interface {
|
||||
// VaultSecretChanged is the vault's event that a secret changed: a name and its generation, never a value.
|
||||
const VaultSecretChanged = "mesh.mod.mesh-vault.event.secret-changed"
|
||||
|
||||
// CatalogRevisionEvents is the seat mesh-catalog's event catalog-revision, whatever branch its subject names: a node-engine asks
|
||||
// again the trunk builds the catalog gave none of at once, not at the end of their backoff (A-487a, design 47 G-12 line 317).
|
||||
const CatalogRevisionEvents = "mesh.seat.mesh-catalog.event.catalog-revision.>"
|
||||
|
||||
// Composer composes the node and is the agent's watcher of its compositions (agent.Env.Composed).
|
||||
type Composer struct {
|
||||
// OnEngine is told the node-engine's own module each time a composing finds it (design 47 G §527, §634); set before the
|
||||
@@ -220,8 +224,11 @@ type Composer struct {
|
||||
// trunkAsking is, by module, a trunk build being asked beside the pass (askTrunkBuilds), under mu.
|
||||
trunkAsking map[string]bool
|
||||
// trunkWhy is, by module, why the last ask of its trunk build gave none, for the words of the one place (A-484).
|
||||
trunkWhy map[string]string
|
||||
heardRead bool
|
||||
trunkWhy map[string]string
|
||||
// trunkRetry is, by module, the backoff of asking its trunk build again after an answer that was none: the asks made in a row
|
||||
// without an answer and the time before which it is not asked (A-487a), under mu.
|
||||
trunkRetry map[string]trunkBackoff
|
||||
heardRead bool
|
||||
// ends is, by module, the last build end naming no branch the builder said of it (NoteBuildEnded), its newest build that
|
||||
// ended, under mu; endsRead is whether the first read of the builder's stream ended (BuildEndsRead) (design 47 G A-293).
|
||||
ends map[string]builds.BuildEnded
|
||||
@@ -540,6 +547,29 @@ func (c *Composer) Watch(ctx context.Context, _ string) (<-chan agent.Update, er
|
||||
}(i, ch)
|
||||
}
|
||||
if c.env.Hear != nil {
|
||||
revisions, stopRevisions, err := c.env.Hear(CatalogRevisionEvents)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the node asks the trunk builds again when the catalog says a revision, and cannot hear it: %w", err)
|
||||
}
|
||||
go func() {
|
||||
defer stopRevisions()
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case _, ok := <-revisions:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
c.trunkRetryCleared()
|
||||
select {
|
||||
case merged <- tagged{in: -1, ok: true}:
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
heard, stop, err := c.env.Hear(VaultSecretChanged)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("the node composes again when a secret changes, and cannot hear the vault say so: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user