Skip to content

Commit

Permalink
fix: support otp < 26
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed Jan 24, 2024
1 parent a9b5a0d commit 125c167
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/wolff_producers.erl
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,20 @@ start_new_producers(#{client_id := ClientId,
end,
St.


-if(OTP_RELEASE >= "26").
get_partition_cnt(ClientId, Topic) ->
ets:lookup_element(?WOLFF_PRODUCERS_GLOBAL_TABLE, {ClientId, Topic, partition_count},
2, ?partition_count_unavailable).
-else.
get_partition_cnt(ClientId, Topic) ->
try ets:lookup_element(?WOLFF_PRODUCERS_GLOBAL_TABLE, {ClientId, Topic, partition_count},
2)
catch
error:badarg ->
?partition_count_unavailable
end.
-endif.

put_partition_cnt(ClientId, Topic, Count) ->
_ = ets:insert(?WOLFF_PRODUCERS_GLOBAL_TABLE, {{ClientId, Topic, partition_count}, Count}),
Expand Down

0 comments on commit 125c167

Please sign in to comment.