Skip to content

Commit 70d56c7

Browse files
authored
Merge pull request #6 from Nitro/mihaitodor/update-servers-only-on-success
Update previous servers cache only when the config reload was successful
2 parents 7235a7c + e0c18ca commit 70d56c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ func innerUpdate(config *Config, previousServers []string) ([]string, error) {
107107

108108
log.Info("Reloading Nginx config...")
109109

110-
previousServers = servers
111-
112110
err = run(config.ValidateCommand)
113111
if err != nil {
114112
return nil, fmt.Errorf("Unable to validate nginx config! (%s)", err)
@@ -124,6 +122,8 @@ func innerUpdate(config *Config, previousServers []string) ([]string, error) {
124122
return nil, fmt.Errorf("Unable to reload nginx config! (%s)", err)
125123
}
126124

125+
previousServers = servers
126+
127127
return servers, nil
128128
}
129129

0 commit comments

Comments
 (0)