@@ -118,7 +118,7 @@ func (ra *ReloadAgent) setLkgPath(configFile, path string) {
118118 ra .lkgConfigFile = configFile + ".lkg"
119119}
120120
121- func (ra * ReloadAgent ) handleReload (id string ) {
121+ func (ra * ReloadAgent ) handleReload (id string ) ( string , error ) {
122122 logFields := map [string ]interface {}{logFieldReloadID : id }
123123 ra .cache .mu .Lock ()
124124 ra .cache .current = id
@@ -136,6 +136,8 @@ func (ra *ReloadAgent) handleReload(id string) {
136136 ra .cache .succeedReload (response )
137137 log .WithFields (logFields , log .DebugLevel , "Handling reload completed, waiting for new requests" )
138138 }
139+
140+ return response , err
139141}
140142
141143func (ra * ReloadAgent ) handleReloads () {
@@ -231,6 +233,15 @@ func (ra *ReloadAgent) Reload() string {
231233
232234// ForceReload calls reload directly
233235func (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+
234245 r , err := ra .reloadHAProxy ("force" )
235246 if err != nil {
236247 return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
@@ -427,5 +438,5 @@ func copyFile(src, dest string) error {
427438 if err != nil {
428439 return err
429440 }
430- return renameio .WriteFile (dest , data , 0644 )
441+ return renameio .WriteFile (dest , data , 0o644 )
431442}
0 commit comments