Skip to content

Commit

Permalink
Merge pull request #36 from keynslug/master
Browse files Browse the repository at this point in the history
chore: silence compiler warning on Erlang/OTP 27 and later
  • Loading branch information
keynslug authored Dec 27, 2024
2 parents 44ba2df + 75c6c8f commit 0c729d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
17 changes: 12 additions & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ jobs:
strategy:
fail-fast: false
matrix:
otp:
- 24.3
- 25.1
erlang:
- otp: "24"
rebar3: "3.20"
- otp: "25"
rebar3: "3.22"
- otp: "26"
rebar3: "3.22"
- otp: "27"
rebar3: "3.24"

steps:
- uses: actions/checkout@v3
- uses: erlef/setup-beam@v1
with:
otp-version: ${{ matrix.otp }}
rebar3-version: 3
otp-version: ${{ matrix.erlang.otp }}
rebar3-version: ${{ matrix.erlang.rebar3 }}
- name: setup redis cluster
run: docker compose up -d --wait
- name: eunit
Expand Down
6 changes: 3 additions & 3 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
%% -*- mode: erlang -*-
{deps, [
{eredis, {git, "https://github.com/emqx/eredis", {tag, "1.2.14"}}},
{eredis, {git, "https://github.com/emqx/eredis", {tag, "1.2.16"}}},
{ecpool, {git, "https://github.com/emqx/ecpool", {tag, "0.5.3"}}}
]}.
{erl_opts, [warnings_as_errors,
warn_export_all]}.

{erl_opts, [warn_export_all]}.

{xref_checks, [undefined_function_calls]}.
{cover_enabled, true}.
Expand Down
5 changes: 5 additions & 0 deletions src/eredis_cluster_monitor.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
-export([terminate/2]).
-export([code_change/3]).
-export([format_status/1]).

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

%% Type definition.
-include("eredis_cluster.hrl").
Expand Down Expand Up @@ -303,8 +306,10 @@ format_status(Status = #{state := State}) ->
%% TODO
%% This is deprecated since OTP-25 in favor of `format_status/1`. Remove once
%% OTP-25 becomes minimum supported OTP version.
-if(?OTP_RELEASE < 25).
format_status(_Opt, [_PDict, State]) ->
[{data, [{"State", censor_state(State)}]}].
-endif.

censor_state(#state{} = State) ->
State#state{password = "******"};
Expand Down
5 changes: 5 additions & 0 deletions src/eredis_cluster_pool_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@
-export([terminate/2]).
-export([code_change/3]).
-export([format_status/1]).

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

-record(state, {conn, host, port, database, credentials}).

Expand Down Expand Up @@ -103,8 +106,10 @@ format_status(Status = #{state := State}) ->
%% TODO
%% This is deprecated since OTP-25 in favor of `format_status/1`. Remove once
%% OTP-25 becomes minimum supported OTP version.
-if(?OTP_RELEASE < 25).
format_status(_Opt, [_PDict, State]) ->
[{data, [{"State", censor_state(State)}]}].
-endif.

censor_state(#state{credentials = Credentials0} = State) ->
Credentials = eredis:redact_credentials(Credentials0),
Expand Down

0 comments on commit 0c729d5

Please sign in to comment.