Skip cache invalidation on failed connection (#3033)

mine
Federico Nafria 2025-02-16 01:23:57 +01:00 committed by GitHub
parent 33d592deb4
commit 30291081f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 0 deletions

View File

@ -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()