Skip to content

Commit

Permalink
Merge pull request #3939 from esl/mod_event_pusher-fix-5.0
Browse files Browse the repository at this point in the history
mod_event_pusher:push_event/3 fix
  • Loading branch information
chrzaszcz authored Jan 27, 2023
2 parents fba12ff + 078ef4b commit 918f38e
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
29 changes: 20 additions & 9 deletions big_tests/tests/push_integration_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ groups() ->
G = [
{pubsub_ful, [], basic_groups()},
{pubsub_less, [], basic_groups()},
{integration_with_sm_and_offline_storage,[parallel],
{integration_with_sm_and_offline_storage,[],
[
no_duplicates_default_plugin,
sm_unack_messages_notified_default_plugin
Expand All @@ -64,7 +64,7 @@ groups() ->
immediate_notification,
double_notification_with_two_sessions_in_resume
]},
{pm_msg_notifications, [parallel],
{pm_msg_notifications, [],
[
pm_msg_notify_on_apns_w_high_priority,
pm_msg_notify_on_fcm_w_high_priority,
Expand All @@ -78,7 +78,7 @@ groups() ->
pm_msg_notify_on_fcm_silent,
pm_msg_notify_on_apns_w_topic
]},
{muclight_msg_notifications, [parallel],
{muclight_msg_notifications, [],
[
muclight_msg_notify_on_apns_w_high_priority,
muclight_msg_notify_on_fcm_w_high_priority,
Expand All @@ -92,22 +92,22 @@ groups() ->
muclight_msg_notify_on_fcm_silent,
muclight_msg_notify_on_w_topic
]},
{groupchat_notifications_with_inbox, [parallel],
{groupchat_notifications_with_inbox, [],
[
muclight_inbox_msg_unread_count_apns,
muclight_inbox_msg_unread_count_fcm,
muclight_aff_change_fcm,
muclight_aff_change_apns
]},
{pm_notifications_with_inbox, [parallel],
{pm_notifications_with_inbox, [],
[
inbox_msg_unread_count_apns,
inbox_msg_unread_count_fcm,
inbox_msg_reset_unread_count_apns,
inbox_msg_reset_unread_count_fcm
]},
{failure_cases_v3, [parallel], failure_cases()},
{failure_cases_v2, [parallel], failure_cases()}
{failure_cases_v3, [], failure_cases()},
{failure_cases_v2, [], failure_cases()}
],
G.

Expand All @@ -128,7 +128,6 @@ init_per_suite(Config) ->
catch mongoose_push_mock:stop(),
mongoose_push_mock:start(Config),
Port = mongoose_push_mock:port(),

PoolOpts = [{strategy, available_worker}, {workers, 20}],
HTTPOpts = [{server, "https://localhost:" ++ integer_to_list(Port)}],
rpc(?RPC_SPEC, mongoose_wpool, start_configured_pools,
Expand Down Expand Up @@ -173,10 +172,22 @@ end_per_group(_, Config) ->
Config.

init_per_testcase(CaseName, Config) ->
%% unfortunately meck:reset(Module) doesn't result
%% in 'valid' flag resetting (see meck_proc module),
%% so we have to unload existing mocking and mock
%% module again before running every test case.
catch rpc(?RPC_SPEC, meck, unload, [mod_event_pusher]),
rpc(?RPC_SPEC, meck, new, [mod_event_pusher, [no_link, passthrough]]),
escalus:init_per_testcase(CaseName, Config).

end_per_testcase(CaseName, Config) ->
escalus:end_per_testcase(CaseName, Config).
Valid = rpc(?RPC_SPEC, meck, validate, [mod_event_pusher]),
rpc(?RPC_SPEC, meck, unload, [mod_event_pusher]),
escalus:end_per_testcase(CaseName, Config),
case Valid of
false -> {fail, "mod_event_pusher crashed"};
true -> ok
end.

%%------------------------------------------------------------------------------------
%% GROUP integration_with_sm_and_offline_storage & enhanced_integration_with_sm
Expand Down
3 changes: 1 addition & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@
{bbmustache, "1.10.0"},
{recon, "2.5.1"},
{erlcloud, "3.5.5"},
%% MR of jwerl - https://gitlab.com/glejeune/jwerl/-/merge_requests/13
{jwerl, {git, "https://gitlab.com/vkatsuba/jwerl.git", {branch, "refactoring/otp-24"}}},
{jwerl, "1.2.0"},
{csv, {git, "https://github.com/bszaf/csv.git", {branch, "master"}}},
%% Do not upgrade cpool to version 0.1.1, it has bugs
{cpool, "0.1.0"},
Expand Down
19 changes: 9 additions & 10 deletions rebar.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.3.1">>},2},
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0},
{<<"cowboy_swagger">>,{pkg,<<"cowboy_swagger">>,<<"2.2.2">>},0},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.8.0">>},1},
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
{<<"cpool">>,{pkg,<<"cpool">>,<<"0.1.0">>},0},
{<<"cqerl">>,
{git,"https://github.com/esl/cqerl.git",
Expand All @@ -20,7 +20,7 @@
{git,"https://github.com/bszaf/csv.git",
{ref,"b0b854d8be2d69b0c6eb9bae5591008098973af9"}},
0},
{<<"eini">>,{pkg,<<"eini">>,<<"1.2.7">>},1},
{<<"eini">>,{pkg,<<"eini">>,<<"1.2.9">>},1},
{<<"eodbc">>,
{git,"https://github.com/arcusfelis/eodbc.git",
{ref,"1823d8fe6f5fbe2d8724a9649b75ebd5b8738661"}},
Expand Down Expand Up @@ -76,10 +76,7 @@
{<<"jid">>,{pkg,<<"mongoose_jid">>,<<"1.0.0">>},0},
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.0.8">>},0},
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.9.0">>},1},
{<<"jwerl">>,
{git,"https://gitlab.com/vkatsuba/jwerl.git",
{ref,"d03607fd14a6a7556f01014af84903a3df60ff5d"}},
0},
{<<"jwerl">>,{pkg,<<"jwerl">>,<<"1.2.0">>},0},
{<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0},
{<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0},
{<<"lhttpc">>,{pkg,<<"lhttpc">>,<<"1.6.2">>},1},
Expand Down Expand Up @@ -167,10 +164,10 @@
{<<"certifi">>, <<"D0F424232390BF47D82DA8478022301C561CF6445B5B5FB6A84D49A9E76D2639">>},
{<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
{<<"cowboy_swagger">>, <<"478F2236C59CBAD27CB581F9866559376BB1D196228D9744D12AC16B0589C628">>},
{<<"cowlib">>, <<"FD0FF1787DB84AC415B8211573E9A30A3EBE71B5CBFF7F720089972B2319C8A4">>},
{<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>},
{<<"cpool">>, <<"76222AA1DAC0F8089707167BD69D221EDA63DB65B8BD67DBF6E133075392EEDC">>},
{<<"credentials_obfuscation">>, <<"9FB57683B84899CA3546B384E59AB5D3054A9F334EBA50D74C82CD0AE82DD6CA">>},
{<<"eini">>, <<"EFC9D836E88591A47550BD34CE964E21CA1369F8716B24F73CFEA513FA99F666">>},
{<<"eini">>, <<"FCC3CBD49BBDD9A1D9735C7365DAFFCD84481CCE81E6CB80537883AA44AC4895">>},
{<<"epgsql">>, <<"A403534D03811C867E79405BB18D6061A5FCEF92ACF0236A9150AC93748CE143">>},
{<<"eredis">>, <<"0B8E9CFC2C00FA1374CD107EA63B49BE08D933DF2CF175E6A89B73DD9C380DE4">>},
{<<"erlang_pmp">>, <<"42FAA89EAF427B71533444F2B433D0010837636149595658499C356A5A39589B">>},
Expand All @@ -186,6 +183,7 @@
{<<"jid">>, <<"B6D8F9E3015CCB36868D5DB1E847C6176C4F7513360F11CA07B8B95DDC42421E">>},
{<<"jiffy">>, <<"60E36F00BE35E5AC6E6CF2D4CAF3BDF3103D4460AFF385F543A8D7DF2D6D9613">>},
{<<"jsx">>, <<"D2F6E5F069C00266CAD52FB15D87C428579EA4D7D73A33669E12679E203329DD">>},
{<<"jwerl">>, <<"2A0EC870BE0B803BBEEE1463DC5AE05E3D64EEAE2ABC7DB4250ABC611FE7E320">>},
{<<"lager">>, <<"4CAB289120EB24964E3886BD22323CB5FEFE4510C076992A23AD18CF85413D8C">>},
{<<"lasse">>, <<"DB8F06983B235F6C4C86AC79BCF23EDDCA16FCCCAD1EB45F222852BB133BD793">>},
{<<"lhttpc">>, <<"044F16F0018C7AA7E945E9E9406C7F6035E0B8BC08BF77B00C78CE260E1071E3">>},
Expand Down Expand Up @@ -220,10 +218,10 @@
{<<"certifi">>, <<"E12D667D042C11D130594BAE2B0097E63836FE8B1E6D6B2CC48F8BB7A2CF7D68">>},
{<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
{<<"cowboy_swagger">>, <<"9BB013B8EE3B40F20FCC43D19785627984829ACBF2F051A45421B66DB6F0E7A1">>},
{<<"cowlib">>, <<"79F954A7021B302186A950A32869DBC185523D99D3E44CE430CD1F3289F41ED4">>},
{<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>},
{<<"cpool">>, <<"430E18DF4A9D584EB1ED0D196A87CC02E878AF5B4888BFDC9B65F86A96480E30">>},
{<<"credentials_obfuscation">>, <<"D28A89830E30698B075DE9A4DBE683A20685C6BED1E3B7DF744A0C06E6FF200A">>},
{<<"eini">>, <<"CD604597DCDB8AD76CCBAAF8C303EF94136729BA4AD6ABC88A4AB800E6D8E99A">>},
{<<"eini">>, <<"DA64AE8DB7C2F502E6F20CDF44CD3D9BE364412B87FF49FEBF282540F673DFCB">>},
{<<"epgsql">>, <<"6BE4910A02551F21EAB6F6F27D97B0D4B1DFFC617F1A64C8C95FDD45652FA9E1">>},
{<<"eredis">>, <<"D9B5ABEF2C2C8ABA8F32AA018203E0B3DC8B1157773B254AB1D4C2002317F1E1">>},
{<<"erlang_pmp">>, <<"58EB8E466B4A1A9E841E59B0CEAB03EFD22FC195BD1B11B1FC6DAE4536DA6A16">>},
Expand All @@ -239,6 +237,7 @@
{<<"jid">>, <<"D96C1223660E54549305252A3492500980505652AEB80950E201A3C446C4C9D2">>},
{<<"jiffy">>, <<"F9AE986BA5A0854EB48CF6A76192D9367086DA86C20197DA430630BE7C087A4E">>},
{<<"jsx">>, <<"8EE1DB1CABAFDD578A2776A6AAAE87C2A8CE54B47B59E9EC7DAB5D7EB71CD8DC">>},
{<<"jwerl">>, <<"894C275CA4CF3A4F293541927CA3D7A2622B21D8BD70580EF70EACB0425F1941">>},
{<<"lager">>, <<"7F904D9E87A8CB7E66156ED31768D1C8E26EBA1D54F4BC85B1AA4AC1F6340C28">>},
{<<"lasse">>, <<"8081769683F73D76A718319A593F8551A0D3747404C51CCE5869CFC6AEDC7EDF">>},
{<<"lhttpc">>, <<"76B5FA6149D1E10D4B1FBC4EBD51D371DB19C1AB9F0A9ECF5B526440DF064E97">>},
Expand Down
3 changes: 2 additions & 1 deletion src/event_pusher/mod_event_pusher.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
%% @doc Pushes the event to each backend registered with the event_pusher.
-spec push_event(mongoose_acc:t(), Host :: jid:server(), Event :: event()) -> mongoose_acc:t().
push_event(Acc, Host, Event) ->
{ok, HostType} = mongoose_domain_api:get_host_type(Host),
lists:foldl(fun(B, Acc0) ->
B:push_event(Acc0, Host, Event) end,
Acc,
ets:lookup_element(ets_name(Host), backends, 2)).
ets:lookup_element(ets_name(HostType), backends, 2)).

%%--------------------------------------------------------------------
%% gen_mod API
Expand Down
2 changes: 1 addition & 1 deletion tools/print-dots.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

PIDFILE=/tmp/print-dots.pid
SLEEPTIME=10s
SLEEPTIME=10

loop () {
while true; do
Expand Down

0 comments on commit 918f38e

Please sign in to comment.