INNER CODE UNIT · Go
handleConfigurationError
bank-vaults/bank-vaults · cmd/bank-vaults/configure.go:173
func handleConfigurationError(parser multiparser.Parser, vaultConfigFile string, configurations chan<- *configFile, sleepTime time.Duration) {
// This handler will sleep for a exponential backoff amount of time and re-inject the failed configuration into the
// configurations channel to be re-applied to vault
// Eventually consistent model - all recoverable errors (5xx and configs that depend on other configs) will be eventually fixed
// non recoverable errors will be retried and keep failing every MAX BACKOFF seconds, increasing the error counters ont he vault-configurator pod.
slog.Info(fmt.Sprintf("Failed applying configuration file: %s , sleeping for %s before trying again", vaultConfigFile, sleepTime))
time.Sleep(sleepTime)
configurations <- parseConfiguration(parser, vaultConfigFile)
}
func watchConfigurations(parser multiparser.Parser, vaultConfigFiles []string, configurations chan<- *configFile) error {
watcher, err := fsnotify.NewWatcher()
if err != nil {
return fmt.Errorf("cannot create watcher: %w", err)
}
defer func() {
if err := watcher.Close(); err != nil {
slog.Error(fmt.Sprintf("error closing watcher: %s", err.Error()))