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 Feb 6, 2025
1 parent e27e293 commit b4783f9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ func (a *APIClient) SwitchContext(name string) error {
if err := a.config.SwitchContext(name); err != nil {
return err
}

if !a.CheckConnectivity() {
log.Debug().Msg("No connectivity, skipping cache invalidation")
} else if err := a.invalidateCache(); err != nil {
return err
}
a.reset()
ResetMetrics()

Expand Down

0 comments on commit b4783f9

Please sign in to comment.