@@ -121,7 +121,7 @@ func (ra *ReloadAgent) setLkgPath(configFile, path string) {
121121 ra .lkgConfigFile = configFile + ".lkg"
122122}
123123
124- func (ra * ReloadAgent ) handleReload (id string ) {
124+ func (ra * ReloadAgent ) handleReload (id string ) ( string , error ) {
125125 logFields := map [string ]interface {}{logFieldReloadID : id }
126126 ra .cache .mu .Lock ()
127127 ra .cache .current = id
@@ -144,6 +144,8 @@ func (ra *ReloadAgent) handleReload(id string) {
144144 log .WithFields (logFields , log .DebugLevel , "Handling reload completed, waiting for new requests" )
145145 }
146146 delete (ra .cache .callbacks , id )
147+
148+ return response , err
147149}
148150
149151func (ra * ReloadAgent ) handleReloads () {
@@ -239,6 +241,15 @@ func (ra *ReloadAgent) Reload() string {
239241
240242// ForceReload calls reload directly
241243func (ra * ReloadAgent ) ForceReload () error {
244+ next := ra .cache .getNext ()
245+ if next != "" {
246+ r , err := ra .handleReload (next )
247+ if err != nil {
248+ return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
249+ }
250+ return nil
251+ }
252+
242253 r , err := ra .reloadHAProxy ("force" )
243254 if err != nil {
244255 return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
@@ -259,6 +270,15 @@ func (ra *ReloadAgent) ReloadWithCallback(callback func()) string {
259270
260271// ForceReload calls reload directly, callback is called only if reload is successfull
261272func (ra * ReloadAgent ) ForceReloadWithCallback (callback func ()) error {
273+ next := ra .cache .getNext ()
274+ if next != "" {
275+ r , err := ra .handleReload (next )
276+ if err != nil {
277+ return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
278+ }
279+ return nil
280+ }
281+
262282 r , err := ra .reloadHAProxy ("force" )
263283 if err != nil {
264284 return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
0 commit comments