Skip to content

Commit

Permalink
fix: first batch of errors
Browse files Browse the repository at this point in the history
  • Loading branch information
polvalente committed Oct 27, 2024
1 parent 1a4a877 commit 053f693
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 12 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ jobs:
otp: 26.1.2
- elixir: 1.15.6
otp: 24.3.4.13
- elixir: 1.11.4
otp: 21.3.8.24
steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
Expand Down
12 changes: 7 additions & 5 deletions lib/klife/client.ex
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ defmodule Klife.Client do

@doc false
@impl Supervisor
def init(_args), do: Klife.Client.init(@otp_app, @input_opts)
def init(_args) do
Klife.Client.init(@otp_app, @input_opts, default_txn_pool_key(), default_producer_key(), default_partitioner_key())
end

@spec produce(Record.t(), opts :: list() | nil) :: {:ok, Record.t()} | {:error, Record.t()}
def produce(%Record{} = rec, opts \\ []), do: Klife.produce(rec, __MODULE__, opts)
Expand All @@ -449,7 +451,7 @@ defmodule Klife.Client do
end

@doc false
def init(otp_app, input_opts) do
def init(otp_app, input_opts, default_txn_pool_key, default_producer_key, default_partitioner_key) do
config = Application.get_env(otp_app, __MODULE__)

validated_opts = NimbleOptions.validate!(config, input_opts)
Expand Down Expand Up @@ -505,9 +507,9 @@ defmodule Klife.Client do
{Klife.Producer.Supervisor, producer_opts}
]

:persistent_term.put(default_txn_pool_key(), parsed_opts[:default_txn_pool])
:persistent_term.put(default_producer_key(), parsed_opts[:default_producer])
:persistent_term.put(default_partitioner_key(), parsed_opts[:default_partitioner])
:persistent_term.put(default_txn_pool_key, parsed_opts[:default_txn_pool])
:persistent_term.put(default_producer_key, parsed_opts[:default_producer])
:persistent_term.put(default_partitioner_key, parsed_opts[:default_partitioner])

Supervisor.init(children, strategy: :one_for_one)
end
Expand Down
3 changes: 0 additions & 3 deletions lib/klife/connection/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ defmodule Klife.Connection.Controller do
# We need to eventually reset the correlation counter value
# in order to avoid reaching this limit.
@max_correlation_counter 2_000_000_000
@check_correlation_counter_delay :timer.seconds(300)
@check_cluster_delay :timer.seconds(10)

@connection_opts [
Expand Down Expand Up @@ -126,8 +125,6 @@ defmodule Klife.Connection.Controller do
{_, state} = handle_info(:init_bootstrap_conn, state)
{_, state} = handle_info(:check_cluster, state)

send(self(), :check_correlation_counter)

state
end

Expand Down
2 changes: 1 addition & 1 deletion lib/klife/producer/dispatcher.ex
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ defmodule Klife.Producer.Dispatcher do

case do_dispatch(data, state) do
{:ok, timeout_ref} ->
{:noreply, put_in(state.timeouts[request_ref], timeout_ref)}}
{:noreply, put_in(state.timeouts[request_ref], timeout_ref)}

{:error, :retry} ->
Process.send_after(self(), {:dispatch, request_ref}, retry_ms)
Expand Down
2 changes: 1 addition & 1 deletion lib/klife/producer/producer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ defmodule Klife.Producer do

@producer_options [
name: [
type: :term,
type: :any,
required: true,
doc: "Producer name. Can be used as an option on the producer api. Must be an unique value."
],
Expand Down

0 comments on commit 053f693

Please sign in to comment.