This commit is contained in:
Ryan Geary 2024-09-26 19:56:16 +00:00 committed by GitHub
commit cd42b85c6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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 {