409
const batchSize = 100
410
for i := 0; i < len(partitions); i += batchSize {
411
>
// We don't own these anymore, but don't unload them immediately, wait a few seconds to ensure
matching_engine.go
412
>
// the membership update has propagated everywhere so that they won't get immediately re-loaded.
413
>
// Note that we don't verify ownership at load time, so this is the only guard against a task
414
>
// queue bouncing back and forth due to long membership propagation time.
415
>
batch := partitions[i:min(len(partitions), i+batchSize)]
416
>
wait := backoff.Jitter(delay, 0.1)
417
>
time.AfterFunc(wait, func() {
418
>
// maybe the whole engine stopped
419
>
if atomic.LoadInt32(&e.status) != common.DaemonStatusStarted {
420
return
421
}
423
>
// maybe ownership changed again
424
>
if !ownedByOther(p) {
425
return
426
}
427
// now we can unload
429
}
430
})