Skip to content

Commit 486980b

Browse files
shuo-wuinnobead
authored andcommitted
manager: Fix the flooded broadcasting issue
Signed-off-by: Shuo Wu <shuo.wu@suse.com>
1 parent eb9d281 commit 486980b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pkg/manager/service.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,20 +104,16 @@ func (m *Manager) startBroadcasting(ctx context.Context) {
104104
defer ticker.Stop()
105105

106106
done := false
107-
for {
107+
for !done {
108108
select {
109109
case <-ctx.Done():
110110
m.log.Info("Backing Image Manager: stopped broadcasting due to context done")
111111
done = true
112-
break
113112
case <-ticker.C:
114113
if m.checkBroadcasting() {
115114
m.broadcastCh <- nil
116115
}
117116
}
118-
if done {
119-
break
120-
}
121117
}
122118
}
123119

@@ -231,7 +227,7 @@ func (m *Manager) listAndUpdate() (biFileInfoMap map[string]*api.FileInfo, err e
231227
for filePath, fInfo := range fInfoList {
232228
biName := types.GetBackingImageNameFromFilePath(filePath, fInfo.UUID)
233229
newBiFileInfoMap[biName] = fInfo
234-
if !m.broadcastRequired && reflect.DeepEqual(m.biFileInfoMap[biName], fInfo) {
230+
if !m.broadcastRequired && !reflect.DeepEqual(m.biFileInfoMap[biName], fInfo) {
235231
m.broadcastRequired = true
236232
}
237233
}

0 commit comments

Comments
 (0)