Skip to content

Commit

Permalink
Move ConsumerGroup.Manager.start_link/4 to conventional start_link/1
Browse files Browse the repository at this point in the history
The change is acceptable as `ConsumerGroup` is the only client of
`ConsumerGroup.Manager`. The defaults on `opts` parameter aren't used
and their loss is thus likewise acceptable.

Fixes a compiler warning due to a deprecated usage of
`Supervisor.Spec.worker/3`.
  • Loading branch information
b1az committed Aug 29, 2022
1 parent 97b577f commit 71eef86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 2 additions & 4 deletions lib/kafka_ex/consumer_group.ex
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,8 @@ defmodule KafkaEx.ConsumerGroup do
opts = Keyword.put(opts, :supervisor_pid, self())

children = [
worker(
KafkaEx.ConsumerGroup.Manager,
[{gen_consumer_module, consumer_module}, group_name, topics, opts]
)
{KafkaEx.ConsumerGroup.Manager,
{{gen_consumer_module, consumer_module}, group_name, topics, opts}}
]

Supervisor.init(children,
Expand Down
10 changes: 5 additions & 5 deletions lib/kafka_ex/consumer_group/manager.ex
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ defmodule KafkaEx.ConsumerGroup.Manager do

@doc false
# use `KafkaEx.ConsumerGroup.start_link/4` instead
@spec start_link(
@spec start_link({
{module, module},
binary,
[binary],
KafkaEx.GenConsumer.options()
) :: GenServer.on_start()
def start_link(
}) :: GenServer.on_start()
def start_link({
{gen_consumer_module, consumer_module},
group_name,
topics,
opts \\ []
) do
opts
}) do
gen_server_opts = Keyword.get(opts, :gen_server_opts, [])
consumer_opts = Keyword.drop(opts, [:gen_server_opts])

Expand Down

0 comments on commit 71eef86

Please sign in to comment.