kafka_ex
kafka_ex copied to clipboard
GenConsumer supervisor necessarily launches consumer module as a worker
In https://github.com/kafkaex/kafka_ex/blob/master/lib/kafka_ex/gen_consumer/supervisor.ex#L92, we can see that the child is launched as a worker.
As a consequence, the shutdown timeout is automatically set to 5_000 ms (among other default settings). However, the child could be implemented as a supervisor, whose timeout would be :infinity (the supervisor being in charge of handling his children termination in time).
I suggest using the child specs mechanism and rewriting it to:
{gen_consumer_module, [consumer_module, group_name]}
so that child_spec/1 is called.
What do you thing?
I think refactoring to use the child specs would be good, and I think will be required to support Elixir 1.10 without generating compile warnings.
KafkaEx.GenConsumer does additional work besides just supervising, so making it a Supervisor might be problematic.