Assigner: say each step of a proposal with its time, and a node record slow or failing to read: a proposal that passed timed out at 30 s with no word of where
This commit is contained in:
@@ -160,7 +160,12 @@ func (s *seatTools) lays() (func(string) bool, func(string) bool, error) {
|
||||
if err != nil || !isNode {
|
||||
continue
|
||||
}
|
||||
if raw, _, found, err := s.st.get(haveState, k); err == nil && found {
|
||||
asked := time.Now()
|
||||
raw, _, found, err := s.st.get(haveState, k)
|
||||
if err != nil || time.Since(asked) > 2*time.Second {
|
||||
fmt.Fprintf(os.Stderr, "mesh-delivery-assigner: the record %s.%s took %s to read: %v\n", haveState, k, time.Since(asked).Round(time.Millisecond), err)
|
||||
}
|
||||
if err == nil && found {
|
||||
if h, err := nodeengineclient.DecodeHaveNode(raw); err == nil && h.Record != nil {
|
||||
recorded[node] = true
|
||||
}
|
||||
@@ -244,11 +249,21 @@ func (s *seatTools) doPropose(args map[string]any, by string) (any, error) {
|
||||
return nil, errors.New("the seed is gone with adopt: propose takes place, take-off, pin, unpin, hold, unhold, decide and config")
|
||||
}
|
||||
}
|
||||
started := time.Now()
|
||||
step := func(what string, err error) {
|
||||
if err != nil {
|
||||
fmt.Fprintf(os.Stderr, "mesh-delivery-assigner: propose by %s: %s failed after %s: %v\n", by, what, time.Since(started).Round(time.Millisecond), err)
|
||||
return
|
||||
}
|
||||
fmt.Fprintf(os.Stderr, "mesh-delivery-assigner: propose by %s: %s at %s\n", by, what, time.Since(started).Round(time.Millisecond))
|
||||
}
|
||||
current, revs, err := s.assignments()
|
||||
step("assignments read", err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
held, recorded, err := s.lays()
|
||||
step("the indexer's modules and the nodes' records read", err)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -264,11 +279,15 @@ func (s *seatTools) doPropose(args map[string]any, by string) (any, error) {
|
||||
findings = append(findings, refusal)
|
||||
}
|
||||
if len(findings) > 0 {
|
||||
step(fmt.Sprintf("refused (%d findings)", len(findings)), nil)
|
||||
return nil, fmt.Errorf("the proposal is refused: %s", strings.Join(findings, "; "))
|
||||
}
|
||||
step("judged", nil)
|
||||
if err := s.write(p); err != nil {
|
||||
step("the proposal "+p.ID+" written", err)
|
||||
return nil, err
|
||||
}
|
||||
step("the proposal "+p.ID+" written", nil)
|
||||
return proposed{Proposal: p, Follow: followProposal(p.ID)}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user