From 8d46580c1370bc4366f6160ec7646c5381bedeb9 Mon Sep 17 00:00:00 2001 From: riccardom Date: Tue, 16 Jun 2026 23:09:59 +0200 Subject: [PATCH] Not the run duty --- client/internal/connect.go | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/client/internal/connect.go b/client/internal/connect.go index 73a3e944c..3bd5dd43b 100644 --- a/client/internal/connect.go +++ b/client/internal/connect.go @@ -444,10 +444,9 @@ func (c *ConnectClient) run(runCtx context.Context, config *profilemanager.Confi if err != nil { log.Debugf("exiting client retry loop due to unrecoverable error: %s", err) if s, ok := gstatus.FromError(err); ok && (s.Code() == codes.PermissionDenied) { + // Login failed permanently: the engine was never started, so there + // is nothing to tear down — just record that a login is needed. state.Set(StatusNeedsLogin) - // Called from inside the run goroutine: tear the engine down - // directly, never through the lifecycle queue (would deadlock). - _ = c.stopEngine() } return err } @@ -541,19 +540,6 @@ func (c *ConnectClient) Stop() error { return c.sup.stop() } -// stopEngine stops the engine directly, bypassing the lifecycle queue. It is -// only safe to call from inside the run goroutine itself (which is what the -// supervisor is waiting on); routing it through the queue there would deadlock. -func (c *ConnectClient) stopEngine() error { - engine := c.Engine() - if engine != nil { - if err := engine.Stop(); err != nil { - return fmt.Errorf("stop engine: %w", err) - } - } - return nil -} - // SetSyncResponsePersistence enables or disables sync response persistence. // When enabled, the last received sync response will be stored and can be retrieved // through the Engine's GetLatestSyncResponse method. When disabled, any stored