Skip to content

Commit

Permalink
fix: Remove eviction operations out of lock (#33834)
Browse files Browse the repository at this point in the history
See also #33823

`EvictCacheValueByFormat` may be block by on going `CASCacheValue` and
cause possible deadlock

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
  • Loading branch information
congqixia committed Jun 13, 2024
1 parent 08fcf3f commit c689ef4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/config/etcd_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ func (es *EtcdSource) update(configs map[string]string) error {
return err
}
es.currentConfigs = configs
es.Unlock()
if es.manager != nil {
es.manager.EvictCacheValueByFormat(lo.Map(events, func(event *Event, _ int) string { return event.Key })...)
}
es.Unlock()

es.configRefresher.fireEvents(events...)
return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/file_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,10 @@ func (fs *FileSource) update(configs map[string]string) error {
return err
}
fs.configs = configs
fs.Unlock()
if fs.manager != nil {
fs.manager.EvictCacheValueByFormat(lo.Map(events, func(event *Event, _ int) string { return event.Key })...)
}
fs.Unlock()

fs.configRefresher.fireEvents(events...)
return nil
Expand Down

0 comments on commit c689ef4

Please sign in to comment.