steal multiple shards per eventLoop
Signed-off-by: Ryan Geary rgeary@lyft.com Signed-off-by: Ryan Geary <rgeary@lyft.com>
This commit is contained in:
parent
f6e79f1a2d
commit
66fdfbb817
1 changed files with 58 additions and 56 deletions
|
|
@ -304,9 +304,11 @@ func (w *Worker) eventLoop() {
|
|||
}
|
||||
}
|
||||
|
||||
// max number of lease has not been reached yet
|
||||
if counter < w.kclConfig.MaxLeasesForWorker {
|
||||
for _, shard := range w.shardStatus {
|
||||
// max number of lease has not been reached yet
|
||||
if counter >= w.kclConfig.MaxLeasesForWorker {
|
||||
break
|
||||
}
|
||||
// already owner of the shard
|
||||
if shard.GetLeaseOwner() == w.workerID {
|
||||
continue
|
||||
|
|
@ -364,9 +366,9 @@ func (w *Worker) eventLoop() {
|
|||
log.Errorf("Error in getRecords: %+v", err)
|
||||
}
|
||||
}(shard)
|
||||
// exit from for loop and not to grab more shard for now.
|
||||
break
|
||||
}
|
||||
|
||||
// Increase the number of leases we have
|
||||
counter++
|
||||
}
|
||||
|
||||
if w.kclConfig.EnableLeaseStealing {
|
||||
|
|
|
|||
Loading…
Reference in a new issue