Indexer: a take-in ask logs its start and end, and the seed logs each step, so a request that hangs says where
This commit is contained in:
@@ -48,6 +48,11 @@ func takenIn(ctx context.Context, ix takerIn, kv jetstream.KeyValue, e jetstream
|
||||
return
|
||||
}
|
||||
asked, r := "take-in", index.TakenIn{}
|
||||
logf("%s.%s: asked by %s (%s): started", index.TakeInsState, e.Key(), a.By, a.Why)
|
||||
started := time.Now()
|
||||
defer func() {
|
||||
logf("%s.%s: ended after %s", index.TakeInsState, e.Key(), time.Since(started).Round(time.Millisecond))
|
||||
}()
|
||||
if a.Registry != nil {
|
||||
asked, r = "registrations' act "+a.Registry.Verb, ix.RegistryAct(ctx, a)
|
||||
} else if a.Recompute {
|
||||
|
||||
@@ -926,20 +926,26 @@ func (r *Registry) Act(ctx context.Context, a TakeInAsk, seed func(context.Conte
|
||||
var modules []SeedModule
|
||||
if composed, _, found, lerr := r.load(ctx, SeedKey); lerr == nil && found && len(composed.Seed) > 0 {
|
||||
// The registrations a seed key composed already are written as composed: no build seat is asked again.
|
||||
r.logf("the seed: writing the %d registrations its key composed (asked by %s)", len(composed.Seed), a.By)
|
||||
var said string
|
||||
said, err = r.ProposeSeed(ctx, nil, act.Again, a.By)
|
||||
answer = map[string]string{"answer": said}
|
||||
} else if seed == nil {
|
||||
err = errors.New("the seed is not composed by this indexer")
|
||||
} else if modules, err = seed(ctx); err == nil {
|
||||
var ask string
|
||||
ask, err = r.ProposeSeed(ctx, modules, act.Again, a.By)
|
||||
answer = map[string]string{"ask": ask}
|
||||
} else {
|
||||
r.logf("the seed: composing from the module graph, asking each build seat for its steps (asked by %s)", a.By)
|
||||
if modules, err = seed(ctx); err == nil {
|
||||
r.logf("the seed: %d modules composed, the build seats answered", len(modules))
|
||||
var said string
|
||||
said, err = r.ProposeSeed(ctx, modules, act.Again, a.By)
|
||||
answer = map[string]string{"answer": said}
|
||||
}
|
||||
}
|
||||
default:
|
||||
err = fmt.Errorf("%q is no act of the registrations", act.Verb)
|
||||
}
|
||||
if err != nil {
|
||||
r.logf("the registrations' act %s ended without an answer: %v", act.Verb, err)
|
||||
out.Answer = err.Error()
|
||||
return out
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user