From d4d308f2e55545ece049f794a1b3ba300bde3d16 Mon Sep 17 00:00:00 2001 From: Federico Nafria Date: Mon, 16 Dec 2024 08:45:39 +0100 Subject: [PATCH] Don't try to invalidate cache without a connection --- internal/client/client.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/client/client.go b/internal/client/client.go index e43a561aa6..f8486baa75 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -545,7 +545,9 @@ func (a *APIClient) SwitchContext(name string) error { if err := a.config.SwitchContext(name); err != nil { return err } - if err := a.invalidateCache(); err != nil { + if !a.getConnOK() { + log.Debug().Msg("No cache to invalidate") + } else if err := a.invalidateCache(); err != nil { return err } a.reset()