Skip to content

Commit

Permalink
manager: Fix the flooded broadcasting issue
Browse files Browse the repository at this point in the history
Signed-off-by: Shuo Wu <shuo.wu@suse.com>
  • Loading branch information
shuo-wu authored and innobead committed Jun 6, 2022
1 parent eb9d281 commit 486980b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions pkg/manager/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,16 @@ func (m *Manager) startBroadcasting(ctx context.Context) {
defer ticker.Stop()

done := false
for {
for !done {
select {
case <-ctx.Done():
m.log.Info("Backing Image Manager: stopped broadcasting due to context done")
done = true
break
case <-ticker.C:
if m.checkBroadcasting() {
m.broadcastCh <- nil
}
}
if done {
break
}
}
}

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

0 comments on commit 486980b

Please sign in to comment.