Skip to content

Commit

Permalink
Skip cache invalidation on failed connection
Browse files Browse the repository at this point in the history
  • Loading branch information
driv committed Jan 13, 2025
1 parent 9b0ffb8 commit 44cea6e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,10 @@ 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.CheckConnectivity() {
log.Debug().Msg("No connectivity, skipping cache invalidation")
} else if err := a.invalidateCache(); err != nil {
return err
}
a.reset()
Expand Down

0 comments on commit 44cea6e

Please sign in to comment.