Skip to content

Commit

Permalink
Merge pull request #585 from kivra-pauoli/chore/support-otp27
Browse files Browse the repository at this point in the history
Add support for OTP 27
  • Loading branch information
zmstone authored Jun 26, 2024
2 parents 40cbc91 + 42a954b commit 01ad88e
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- master
env:
OTP_VERSION: "26"
REBAR_VERSION: "3.20.0"
REBAR_VERSION: "3.23.0"

jobs:
lint:
Expand Down Expand Up @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
otp: ["26"]
otp: ["26", "27"]
kafka: ["0.9", "0.10", "0.11", "2.8", "1.1", "3.6"]
steps:
- name: Checkout
Expand Down
4 changes: 2 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{deps, [ {kafka_protocol, "4.1.5"}
, {snappyer, "1.2.9"}
]}.
{project_plugins, [{coveralls, "~> 2.2.0"}, {rebar3_lint, "~> 1.0.2"}]}.
{project_plugins, [{coveralls, "~> 2.2.0"}, {rebar3_lint, "~> 3.2.5"}]}.
{edoc_opts, [{preprocess, true}, {macros, [{build_brod_cli, true}]}]}.
{erl_opts, [warnings_as_errors, warn_unused_vars,warn_shadow_vars,warn_obsolete_guard,debug_info]}.
{xref_checks, [undefined_function_calls, undefined_functions,
Expand All @@ -28,7 +28,7 @@
, {jsone, "1.7.0"}
, {meck, "0.9.2"}
, {proper, "1.4.0"}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {branch, "1.0.8"}}}
, {snabbkaffe, {git, "https://github.com/kafka4beam/snabbkaffe.git", {branch, "1.0.10"}}}
]},
{erl_opts, [warnings_as_errors, {d, build_brod_cli}]}
]}
Expand Down
6 changes: 3 additions & 3 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{"1.2.0",
[{<<"crc32cer">>,{pkg,<<"crc32cer">>,<<"0.1.8">>},1},
{<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.3">>},0},
{<<"kafka_protocol">>,{pkg,<<"kafka_protocol">>,<<"4.1.5">>},0},
{<<"snappyer">>,{pkg,<<"snappyer">>,<<"1.2.9">>},0}]}.
[
{pkg_hash,[
{<<"crc32cer">>, <<"C6C2275C5FB60A95F4935D414F30B50EE9CFED494081C9B36EBB02EDFC2F48DB">>},
{<<"kafka_protocol">>, <<"362D85A898D4148A43DBABB10A30BB2D6FF32BA0097EB06981D11B34E2E0A9CD">>},
{<<"kafka_protocol">>, <<"D15E64994A8CA99716AB47DB4132614359AC1BFA56D6C5B4341FDC1AA4041518">>},
{<<"snappyer">>, <<"9CC58470798648CE34C662CA0AA6DAAE31367667714C9A543384430A3586E5D3">>}]},
{pkg_hash_ext,[
{<<"crc32cer">>, <<"251499085482920DEB6C9B7AADABF9FB4C432F96ADD97AB42AEE4501E5B6F591">>},
{<<"kafka_protocol">>, <<"28CF73001270D972524DD0FAD4A59074F4441219F9CF237AD808A2AC1EC97487">>},
{<<"kafka_protocol">>, <<"C956C9357FEF493B7072A35D0C3E2BE02AA5186C804A412D29E62423BB15E5D9">>},
{<<"snappyer">>, <<"18D00CA218AE613416E6EECAFE1078DB86342A66F86277BD45C95F05BF1C8B29">>}]}
].
16 changes: 15 additions & 1 deletion src/brod_producer.erl
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@
, handle_info/2
, init/1
, terminate/2
, format_status/2
]).

-if(?OTP_RELEASE < 25).
-export([format_status/2]).
-else.
-export([format_status/1]).
-endif.

-export([ do_send_fun/4
, do_no_ack/2
, do_bufcb/2
Expand Down Expand Up @@ -408,12 +413,21 @@ terminate(Reason, #state{client_pid = ClientPid
ok.

%% @private
-if(?OTP_RELEASE < 25).
format_status(normal, [_PDict, State=#state{}]) ->
[{data, [{"State", State}]}];
format_status(terminate, [_PDict, State=#state{buffer = Buffer}]) ->
%% Do not format the buffer attribute when process terminates abnormally and logs an error
%% but allow it when is a sys:get_status/1.2
State#state{buffer = brod_producer_buffer:empty_buffers(Buffer)}.
-else.
format_status(#{reason := normal} = Status) ->
Status;
format_status(#{reason := terminate, state := #state{buffer = Buffer} = State} = Status) ->
%% Do not format the buffer attribute when process terminates abnormally and logs an error
%% but allow it when is a sys:get_status/1.2
Status#{state => State#state{buffer = brod_producer_buffer:empty_buffers(Buffer)}}.
-endif.

%%%_* Internal Functions =======================================================

Expand Down
8 changes: 1 addition & 7 deletions src/brod_supervisor3.erl
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@

%% Internal exports
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, format_status/2]).
terminate/2, code_change/3]).
-export([try_again_restart/3]).

%%--------------------------------------------------------------------------
Expand Down Expand Up @@ -735,12 +735,6 @@ code_change(_, State, _) ->
Error
end.

format_status(terminate, [_PDict, State]) ->
State;
format_status(_, [_PDict, State]) ->
[{data, [{"State", State}]},
{supervisor, [{"Callback", State#state.module}]}].

check_flags({Strategy, MaxIntensity, Period}) ->
valid_strategy(Strategy),
valid_intensity(MaxIntensity),
Expand Down

0 comments on commit 01ad88e

Please sign in to comment.