mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-03 14:54:53 -04:00
cli: refuse to retry init once gRPC has reached READY one time
This commit is contained in:
parent
77d19eb896
commit
822d7823f8
1 changed files with 14 additions and 6 deletions
|
@ -228,9 +228,16 @@ type initDoer struct {
|
||||||
resp *initproto.InitResponse
|
resp *initproto.InitResponse
|
||||||
log debugLog
|
log debugLog
|
||||||
spinner spinnerInterf
|
spinner spinnerInterf
|
||||||
|
connectedOnce bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *initDoer) Do(ctx context.Context) error {
|
func (d *initDoer) Do(ctx context.Context) error {
|
||||||
|
// connectedOnce is set in handleGRPCStateChanges when a connection was established in one retry attempt.
|
||||||
|
// This should cancel any other retry attempts when the connection is lost since the bootstrapper likely won't accept any new attempts anymore.
|
||||||
|
if d.connectedOnce {
|
||||||
|
return &nonRetriableError{errors.New("init already connected to the remote server in an previous attempt - resumption is not supported")}
|
||||||
|
}
|
||||||
|
|
||||||
conn, err := d.dialer.Dial(ctx, d.endpoint)
|
conn, err := d.dialer.Dial(ctx, d.endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.log.Debugf("Dialing init server failed: %w. Retrying...", err)
|
d.log.Debugf("Dialing init server failed: %w. Retrying...", err)
|
||||||
|
@ -266,6 +273,7 @@ func (d *initDoer) handleGRPCStateChanges(ctx context.Context, wg *sync.WaitGrou
|
||||||
}
|
}
|
||||||
if state == connectivity.Ready {
|
if state == connectivity.Ready {
|
||||||
d.log.Debugf("Connection ready")
|
d.log.Debugf("Connection ready")
|
||||||
|
d.connectedOnce = true
|
||||||
d.spinner.Stop()
|
d.spinner.Stop()
|
||||||
d.spinner.Start("Initializing cluster ", false)
|
d.spinner.Start("Initializing cluster ", false)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue