File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,9 @@ func (ra *ReloadAgent) ReloadWithCallback(callback func()) string {
292292 next = ra .cache .newReloadWithCallback (callback )
293293 log .WithFields (map [string ]interface {}{logFieldReloadID : next }, log .DebugLevel , "Scheduling a new reload..." )
294294 }
295-
295+ ra .cache .mu .Lock ()
296+ ra .cache .callbacks [next ] = callback
297+ ra .cache .mu .Unlock ()
296298 return next
297299}
298300
@@ -304,6 +306,7 @@ func (ra *ReloadAgent) ForceReloadWithCallback(callback func()) error {
304306 if err != nil {
305307 return NewReloadError (fmt .Sprintf ("Reload failed: %v, %v" , err , r ))
306308 }
309+ callback ()
307310 return nil
308311 }
309312
@@ -338,7 +341,9 @@ func (rc *reloadCache) newReload() string {
338341
339342func (rc * reloadCache ) newReloadWithCallback (callback func ()) string {
340343 next := rc .newReload ()
344+ rc .mu .Lock ()
341345 rc .callbacks [next ] = callback
346+ rc .mu .Unlock ()
342347 return next
343348}
344349
You can’t perform that action at this time.
0 commit comments