@@ -121,7 +121,7 @@ func (ra *ReloadAgent) setLkgPath(configFile, path string) {
121
121
ra .lkgConfigFile = configFile + ".lkg"
122
122
}
123
123
124
- func (ra * ReloadAgent ) handleReload (id string ) {
124
+ func (ra * ReloadAgent ) handleReload (id string ) ( string , error ) {
125
125
logFields := map [string ]interface {}{logFieldReloadID : id }
126
126
ra .cache .mu .Lock ()
127
127
ra .cache .current = id
@@ -144,6 +144,8 @@ func (ra *ReloadAgent) handleReload(id string) {
144
144
log .WithFields (logFields , log .DebugLevel , "Handling reload completed, waiting for new requests" )
145
145
}
146
146
delete (ra .cache .callbacks , id )
147
+
148
+ return response , err
147
149
}
148
150
149
151
func (ra * ReloadAgent ) handleReloads () {
@@ -239,6 +241,15 @@ func (ra *ReloadAgent) Reload() string {
239
241
240
242
// ForceReload calls reload directly
241
243
func (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
+
242
253
r , err := ra .reloadHAProxy ("force" )
243
254
if err != nil {
244
255
return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
@@ -259,6 +270,15 @@ func (ra *ReloadAgent) ReloadWithCallback(callback func()) string {
259
270
260
271
// ForceReload calls reload directly, callback is called only if reload is successfull
261
272
func (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
+
262
282
r , err := ra .reloadHAProxy ("force" )
263
283
if err != nil {
264
284
return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
0 commit comments