Skip to content

Commit

Permalink
Fix type spec in brod_transaction
Browse files Browse the repository at this point in the history
`brod:transaction` spec is:

```erlang
-spec transaction(client(), transactional_id(), transaction_config()) -> {ok, transaction()}.
```

and brod_transaction:init also has:

```erlang
init({Client, TxId, PropListConfig}) ->
  ClientPid = pid(Client),
```

but new and start_link were expecting only a pid. The client() spec
itself is:

```erlang
-type client() :: client_id() | pid().
```
  • Loading branch information
indrekj committed Jul 1, 2024
1 parent 636e448 commit d253047
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/brod_transaction.erl
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@
%%==============================================================================

%% @see start_link/3
-spec new(pid(), transactional_id(), transaction_config()) -> {ok, transaction()}.
new(ClientPid, TxId, Config) ->
-spec new(client(), transactional_id(), transaction_config()) -> {ok, transaction()}.
new(Client, TxId, Config) ->
gen_server:start_link(?MODULE,
{ClientPid, TxId, Config},
{Client, TxId, Config},
[]).

%% @doc Start a new transaction, `TxId'will be the id of the transaction
Expand All @@ -145,9 +145,9 @@ new(ClientPid, TxId, Config) ->
%% `backoff_step': after each retry it will sleep for 2^Attempt * backoff_step
%% millis
%% `max_retries'
-spec start_link(pid(), transactional_id(), transaction_config()) -> {ok, pid()}.
start_link(ClientPid, TxId, Config) ->
gen_server:start_link(?MODULE, {ClientPid, TxId, Config}, []).
-spec start_link(client(), transactional_id(), transaction_config()) -> {ok, pid()}.
start_link(Client, TxId, Config) ->
gen_server:start_link(?MODULE, {Client, TxId, Config}, []).

%% @doc Produce the message (key and value) to the indicated topic-partition
%% synchronously.
Expand Down

0 comments on commit d253047

Please sign in to comment.