Merge pull request #2962 from Infisical/fix/address-indefinite-hang-for-run-watch-failure

fix: address infinite hang when infisical run watch fails
This commit is contained in:
Sheen
2025-01-10 11:54:51 +08:00
committed by GitHub
+4 -3
View File
@@ -419,12 +419,14 @@ func executeCommandWithWatchMode(commandFlag string, args []string, watchModeInt
for { for {
<-recheckSecretsChannel <-recheckSecretsChannel
func() {
watchMutex.Lock() watchMutex.Lock()
defer watchMutex.Unlock()
newEnvironmentVariables, err := fetchAndFormatSecretsForShell(request, projectConfigDir, secretOverriding, token) newEnvironmentVariables, err := fetchAndFormatSecretsForShell(request, projectConfigDir, secretOverriding, token)
if err != nil { if err != nil {
log.Error().Err(err).Msg("[HOT RELOAD] Failed to fetch secrets") log.Error().Err(err).Msg("[HOT RELOAD] Failed to fetch secrets")
continue return
} }
if newEnvironmentVariables.ETag != currentETag { if newEnvironmentVariables.ETag != currentETag {
@@ -433,8 +435,7 @@ func executeCommandWithWatchMode(commandFlag string, args []string, watchModeInt
log.Debug().Msg("[HOT RELOAD] No changes detected in secrets, not reloading process") log.Debug().Msg("[HOT RELOAD] No changes detected in secrets, not reloading process")
} }
watchMutex.Unlock() }()
} }
} }