A node is given how it hears its declarations as it enrols
The node's declaration consumer was asserted only when the control plane started, so the first machine of a mesh, enrolling after the control plane was up, joined and then heard nothing: its host retried 'consumer not found' for ever (novox/hq issue 146).
This commit is contained in:
@@ -73,6 +73,8 @@ type Server struct {
|
||||
inbound Inbound
|
||||
bus Bus
|
||||
js *broker.JetStream
|
||||
// consumers makes a node's declaration consumer as it enrols; the bus connection, or a stand-in.
|
||||
consumers interface{ EnsureConsumer(broker.Consumer) error }
|
||||
|
||||
enroller Enroller
|
||||
listener Listener
|
||||
@@ -383,6 +385,7 @@ func (s *Server) enrolling(ctx context.Context, m Control) {
|
||||
default:
|
||||
reply = accepted
|
||||
s.log.Printf("enrolled %s", accepted.Node)
|
||||
s.hearsItsDeclarations(accepted.Node)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,6 +405,24 @@ func (s *Server) enrolling(ctx context.Context, m Control) {
|
||||
_ = m.Took()
|
||||
}
|
||||
|
||||
// hearsItsDeclarations makes the consumer a node reads its declarations through, as it enrols and
|
||||
// before it is answered.
|
||||
//
|
||||
// **Created at enrolment, as the consumer's own doc has always said** (novox/hq 04-ISSUES/146). It
|
||||
// was asserted only when the control plane started, so the first machine of a mesh — which enrols
|
||||
// after the control plane is already up — joined and then heard nothing, its host retrying "consumer
|
||||
// not found" for ever. Failing here is said and does not unspend the token: the next start of the
|
||||
// control plane asserts it again.
|
||||
func (s *Server) hearsItsDeclarations(node string) {
|
||||
if s.consumers == nil {
|
||||
return
|
||||
}
|
||||
if err := s.consumers.EnsureConsumer(broker.NodeConsumer(node)); err != nil {
|
||||
s.log.Printf("%s enrolled, and how it hears its declarations could not be made — it will hear "+
|
||||
"nothing until the control plane next starts: %v", node, err)
|
||||
}
|
||||
}
|
||||
|
||||
// wasBuilt keeps what a builder said, whichever way it went.
|
||||
//
|
||||
// This is for results nobody was waiting for. A build asked for with `build` is answered directly
|
||||
|
||||
Reference in New Issue
Block a user