@@ -118,7 +118,7 @@ func (ra *ReloadAgent) setLkgPath(configFile, path string) {
118
118
ra .lkgConfigFile = configFile + ".lkg"
119
119
}
120
120
121
- func (ra * ReloadAgent ) handleReload (id string ) {
121
+ func (ra * ReloadAgent ) handleReload (id string ) ( string , error ) {
122
122
logFields := map [string ]interface {}{logFieldReloadID : id }
123
123
ra .cache .mu .Lock ()
124
124
ra .cache .current = id
@@ -136,6 +136,8 @@ func (ra *ReloadAgent) handleReload(id string) {
136
136
ra .cache .succeedReload (response )
137
137
log .WithFields (logFields , log .DebugLevel , "Handling reload completed, waiting for new requests" )
138
138
}
139
+
140
+ return response , err
139
141
}
140
142
141
143
func (ra * ReloadAgent ) handleReloads () {
@@ -231,6 +233,15 @@ func (ra *ReloadAgent) Reload() string {
231
233
232
234
// ForceReload calls reload directly
233
235
func (ra * ReloadAgent ) ForceReload () error {
236
+ next := ra .cache .getNext ()
237
+ if next != "" {
238
+ r , err := ra .handleReload (next )
239
+ if err != nil {
240
+ return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
241
+ }
242
+ return nil
243
+ }
244
+
234
245
r , err := ra .reloadHAProxy ("force" )
235
246
if err != nil {
236
247
return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
@@ -427,5 +438,5 @@ func copyFile(src, dest string) error {
427
438
if err != nil {
428
439
return err
429
440
}
430
- return renameio .WriteFile (dest , data , 0644 )
441
+ return renameio .WriteFile (dest , data , 0o644 )
431
442
}
0 commit comments