mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
simplify control flow
This commit is contained in:
parent
7685b393c2
commit
ee24648300
@ -726,8 +726,15 @@ func (p *sharedProcessor) distribute(obj interface{}, sync bool) {
|
||||
defer p.listenersLock.RUnlock()
|
||||
|
||||
for listener, isSyncing := range p.listeners {
|
||||
if !sync || isSyncing {
|
||||
switch {
|
||||
case !sync:
|
||||
// non-sync messages are delivered to every listener
|
||||
listener.add(obj)
|
||||
case isSyncing:
|
||||
// sync messages are delivered to every syncing listenter
|
||||
listener.add(obj)
|
||||
default:
|
||||
// skipping a sync obj for a non-syncing listener
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user