Skip to content

Commit

Permalink
Don't try to invalidate cache without a connection
Browse files Browse the repository at this point in the history
  • Loading branch information
driv committed Dec 16, 2024
1 parent 9b0ffb8 commit d4d308f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit d4d308f

Please sign in to comment.