Open calebstewart opened 2 years ago
@calebstewart I'm trying this out for my application and it seems to work much better, any chance of merging such a change?
I don't have any issues with that. I had never received any confirmation or response, so I was never certain my perspective was correct.
Describe the bug
The current worker implementation will only grab a lease for a single shard per shard sync interval. This seems like a bug. Based on the commit message (e2a945d824043765a899686bcda428bc68c5ea5b), the intent was to "prevent on host tak[ing] more shard[s] than it's configuration allowed". However, the result is that only a single shard is leased per interval. This causes start up times to balloon as more shards are introduced.
Reproduction steps
A basic worker on a stream with multiple shards exhibits this behavior:
Expected behavior
A worker should lease as many shards as it can up to
MaxLeasesPerWorker
on every shard sync.Additional context
I believe the solution is to refactor the lease loop (ref) to look something like this: