mirror of https://github.com/milvus-io/milvus.git
Fix data race for config with FileSource (#26518)
Signed-off-by: yah01 <yah2er0ne@outlook.com>pull/26604/head
parent
c2b53bb9fe
commit
c3f5856fbc
|
@ -91,6 +91,8 @@ func (fs *FileSource) Close() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *FileSource) SetEventHandler(eh EventHandler) {
|
func (fs *FileSource) SetEventHandler(eh EventHandler) {
|
||||||
|
fs.RWMutex.Lock()
|
||||||
|
defer fs.RWMutex.Unlock()
|
||||||
fs.configRefresher.eh = eh
|
fs.configRefresher.eh = eh
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ func (r *refresher) fireEvents(name string, source, target map[string]string) er
|
||||||
log.Warn("generating event error", zap.Error(err))
|
log.Warn("generating event error", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
//Generate OnEvent Callback based on the events created
|
// Generate OnEvent Callback based on the events created
|
||||||
if r.eh != nil {
|
if r.eh != nil {
|
||||||
for _, e := range events {
|
for _, e := range events {
|
||||||
r.eh.OnEvent(e)
|
r.eh.OnEvent(e)
|
||||||
|
|
Loading…
Reference in New Issue