Github user pnowojski commented on the issue:
https://github.com/apache/flink/pull/4321
Good catch with with this spinning, I missed that.
Checking per each iteration for assigned partitions is unfortunately
costly, because there is no cheap `isEmpty()` method. The one that I have found
`consumer.assignment()` is pretty costly (creates quite a lot of objects and
takes some locks). I wouldn't want to call it very often.
I could move this variable to local scope of `run()` function, but it would
be a little bit more error prone (in case some refactoring and for example
calling `reassignPartitions()` from somewhere else outside of the `run()`
method).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---