runDistributor distributes batches to subscribers
()
| 314 | |
| 315 | // runDistributor distributes batches to subscribers |
| 316 | func (wm *watchManager) runDistributor() { |
| 317 | for { |
| 318 | select { |
| 319 | case batch, ok := <-wm.distributeChan: |
| 320 | if !ok { |
| 321 | return |
| 322 | } |
| 323 | _ = wm.distributeAllMessages(batch) |
| 324 | |
| 325 | case <-wm.workerCtx.Done(): |
| 326 | // drain the distribute channel |
| 327 | for { |
| 328 | select { |
| 329 | case batch, ok := <-wm.distributeChan: |
| 330 | if !ok { |
| 331 | return |
| 332 | } |
| 333 | _ = wm.distributeAllMessages(batch) |
| 334 | default: |
| 335 | return |
| 336 | } |
| 337 | } |
| 338 | } |
| 339 | } |
| 340 | } |
| 341 | |
| 342 | // runVictimCollector collects the victim buckets from the victim channel |
| 343 | // and handle delete bucket operation |
no test coverage detected