Skip to content

Commit 918f38e

Browse files
authored
Merge pull request #3939 from esl/mod_event_pusher-fix-5.0
mod_event_pusher:push_event/3 fix
2 parents fba12ff + 078ef4b commit 918f38e

File tree

5 files changed

+33
-23
lines changed

5 files changed

+33
-23
lines changed

big_tests/tests/push_integration_SUITE.erl

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ groups() ->
5454
G = [
5555
{pubsub_ful, [], basic_groups()},
5656
{pubsub_less, [], basic_groups()},
57-
{integration_with_sm_and_offline_storage,[parallel],
57+
{integration_with_sm_and_offline_storage,[],
5858
[
5959
no_duplicates_default_plugin,
6060
sm_unack_messages_notified_default_plugin
@@ -64,7 +64,7 @@ groups() ->
6464
immediate_notification,
6565
double_notification_with_two_sessions_in_resume
6666
]},
67-
{pm_msg_notifications, [parallel],
67+
{pm_msg_notifications, [],
6868
[
6969
pm_msg_notify_on_apns_w_high_priority,
7070
pm_msg_notify_on_fcm_w_high_priority,
@@ -78,7 +78,7 @@ groups() ->
7878
pm_msg_notify_on_fcm_silent,
7979
pm_msg_notify_on_apns_w_topic
8080
]},
81-
{muclight_msg_notifications, [parallel],
81+
{muclight_msg_notifications, [],
8282
[
8383
muclight_msg_notify_on_apns_w_high_priority,
8484
muclight_msg_notify_on_fcm_w_high_priority,
@@ -92,22 +92,22 @@ groups() ->
9292
muclight_msg_notify_on_fcm_silent,
9393
muclight_msg_notify_on_w_topic
9494
]},
95-
{groupchat_notifications_with_inbox, [parallel],
95+
{groupchat_notifications_with_inbox, [],
9696
[
9797
muclight_inbox_msg_unread_count_apns,
9898
muclight_inbox_msg_unread_count_fcm,
9999
muclight_aff_change_fcm,
100100
muclight_aff_change_apns
101101
]},
102-
{pm_notifications_with_inbox, [parallel],
102+
{pm_notifications_with_inbox, [],
103103
[
104104
inbox_msg_unread_count_apns,
105105
inbox_msg_unread_count_fcm,
106106
inbox_msg_reset_unread_count_apns,
107107
inbox_msg_reset_unread_count_fcm
108108
]},
109-
{failure_cases_v3, [parallel], failure_cases()},
110-
{failure_cases_v2, [parallel], failure_cases()}
109+
{failure_cases_v3, [], failure_cases()},
110+
{failure_cases_v2, [], failure_cases()}
111111
],
112112
G.
113113

@@ -128,7 +128,6 @@ init_per_suite(Config) ->
128128
catch mongoose_push_mock:stop(),
129129
mongoose_push_mock:start(Config),
130130
Port = mongoose_push_mock:port(),
131-
132131
PoolOpts = [{strategy, available_worker}, {workers, 20}],
133132
HTTPOpts = [{server, "https://localhost:" ++ integer_to_list(Port)}],
134133
rpc(?RPC_SPEC, mongoose_wpool, start_configured_pools,
@@ -173,10 +172,22 @@ end_per_group(_, Config) ->
173172
Config.
174173

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

178183
end_per_testcase(CaseName, Config) ->
179-
escalus:end_per_testcase(CaseName, Config).
184+
Valid = rpc(?RPC_SPEC, meck, validate, [mod_event_pusher]),
185+
rpc(?RPC_SPEC, meck, unload, [mod_event_pusher]),
186+
escalus:end_per_testcase(CaseName, Config),
187+
case Valid of
188+
false -> {fail, "mod_event_pusher crashed"};
189+
true -> ok
190+
end.
180191

181192
%%------------------------------------------------------------------------------------
182193
%% GROUP integration_with_sm_and_offline_storage & enhanced_integration_with_sm

rebar.config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@
9393
{bbmustache, "1.10.0"},
9494
{recon, "2.5.1"},
9595
{erlcloud, "3.5.5"},
96-
%% MR of jwerl - https://gitlab.com/glejeune/jwerl/-/merge_requests/13
97-
{jwerl, {git, "https://gitlab.com/vkatsuba/jwerl.git", {branch, "refactoring/otp-24"}}},
96+
{jwerl, "1.2.0"},
9897
{csv, {git, "https://github.com/bszaf/csv.git", {branch, "master"}}},
9998
%% Do not upgrade cpool to version 0.1.1, it has bugs
10099
{cpool, "0.1.0"},

rebar.lock

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{<<"certifi">>,{pkg,<<"certifi">>,<<"2.3.1">>},2},
88
{<<"cowboy">>,{pkg,<<"cowboy">>,<<"2.9.0">>},0},
99
{<<"cowboy_swagger">>,{pkg,<<"cowboy_swagger">>,<<"2.2.2">>},0},
10-
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.8.0">>},1},
10+
{<<"cowlib">>,{pkg,<<"cowlib">>,<<"2.11.0">>},1},
1111
{<<"cpool">>,{pkg,<<"cpool">>,<<"0.1.0">>},0},
1212
{<<"cqerl">>,
1313
{git,"https://github.com/esl/cqerl.git",
@@ -20,7 +20,7 @@
2020
{git,"https://github.com/bszaf/csv.git",
2121
{ref,"b0b854d8be2d69b0c6eb9bae5591008098973af9"}},
2222
0},
23-
{<<"eini">>,{pkg,<<"eini">>,<<"1.2.7">>},1},
23+
{<<"eini">>,{pkg,<<"eini">>,<<"1.2.9">>},1},
2424
{<<"eodbc">>,
2525
{git,"https://github.com/arcusfelis/eodbc.git",
2626
{ref,"1823d8fe6f5fbe2d8724a9649b75ebd5b8738661"}},
@@ -76,10 +76,7 @@
7676
{<<"jid">>,{pkg,<<"mongoose_jid">>,<<"1.0.0">>},0},
7777
{<<"jiffy">>,{pkg,<<"jiffy">>,<<"1.0.8">>},0},
7878
{<<"jsx">>,{pkg,<<"jsx">>,<<"2.9.0">>},1},
79-
{<<"jwerl">>,
80-
{git,"https://gitlab.com/vkatsuba/jwerl.git",
81-
{ref,"d03607fd14a6a7556f01014af84903a3df60ff5d"}},
82-
0},
79+
{<<"jwerl">>,{pkg,<<"jwerl">>,<<"1.2.0">>},0},
8380
{<<"lager">>,{pkg,<<"lager">>,<<"3.9.2">>},0},
8481
{<<"lasse">>,{pkg,<<"lasse">>,<<"1.2.0">>},0},
8582
{<<"lhttpc">>,{pkg,<<"lhttpc">>,<<"1.6.2">>},1},
@@ -167,10 +164,10 @@
167164
{<<"certifi">>, <<"D0F424232390BF47D82DA8478022301C561CF6445B5B5FB6A84D49A9E76D2639">>},
168165
{<<"cowboy">>, <<"865DD8B6607E14CF03282E10E934023A1BD8BE6F6BACF921A7E2A96D800CD452">>},
169166
{<<"cowboy_swagger">>, <<"478F2236C59CBAD27CB581F9866559376BB1D196228D9744D12AC16B0589C628">>},
170-
{<<"cowlib">>, <<"FD0FF1787DB84AC415B8211573E9A30A3EBE71B5CBFF7F720089972B2319C8A4">>},
167+
{<<"cowlib">>, <<"0B9FF9C346629256C42EBE1EEB769A83C6CB771A6EE5960BD110AB0B9B872063">>},
171168
{<<"cpool">>, <<"76222AA1DAC0F8089707167BD69D221EDA63DB65B8BD67DBF6E133075392EEDC">>},
172169
{<<"credentials_obfuscation">>, <<"9FB57683B84899CA3546B384E59AB5D3054A9F334EBA50D74C82CD0AE82DD6CA">>},
173-
{<<"eini">>, <<"EFC9D836E88591A47550BD34CE964E21CA1369F8716B24F73CFEA513FA99F666">>},
170+
{<<"eini">>, <<"FCC3CBD49BBDD9A1D9735C7365DAFFCD84481CCE81E6CB80537883AA44AC4895">>},
174171
{<<"epgsql">>, <<"A403534D03811C867E79405BB18D6061A5FCEF92ACF0236A9150AC93748CE143">>},
175172
{<<"eredis">>, <<"0B8E9CFC2C00FA1374CD107EA63B49BE08D933DF2CF175E6A89B73DD9C380DE4">>},
176173
{<<"erlang_pmp">>, <<"42FAA89EAF427B71533444F2B433D0010837636149595658499C356A5A39589B">>},
@@ -186,6 +183,7 @@
186183
{<<"jid">>, <<"B6D8F9E3015CCB36868D5DB1E847C6176C4F7513360F11CA07B8B95DDC42421E">>},
187184
{<<"jiffy">>, <<"60E36F00BE35E5AC6E6CF2D4CAF3BDF3103D4460AFF385F543A8D7DF2D6D9613">>},
188185
{<<"jsx">>, <<"D2F6E5F069C00266CAD52FB15D87C428579EA4D7D73A33669E12679E203329DD">>},
186+
{<<"jwerl">>, <<"2A0EC870BE0B803BBEEE1463DC5AE05E3D64EEAE2ABC7DB4250ABC611FE7E320">>},
189187
{<<"lager">>, <<"4CAB289120EB24964E3886BD22323CB5FEFE4510C076992A23AD18CF85413D8C">>},
190188
{<<"lasse">>, <<"DB8F06983B235F6C4C86AC79BCF23EDDCA16FCCCAD1EB45F222852BB133BD793">>},
191189
{<<"lhttpc">>, <<"044F16F0018C7AA7E945E9E9406C7F6035E0B8BC08BF77B00C78CE260E1071E3">>},
@@ -220,10 +218,10 @@
220218
{<<"certifi">>, <<"E12D667D042C11D130594BAE2B0097E63836FE8B1E6D6B2CC48F8BB7A2CF7D68">>},
221219
{<<"cowboy">>, <<"2C729F934B4E1AA149AFF882F57C6372C15399A20D54F65C8D67BEF583021BDE">>},
222220
{<<"cowboy_swagger">>, <<"9BB013B8EE3B40F20FCC43D19785627984829ACBF2F051A45421B66DB6F0E7A1">>},
223-
{<<"cowlib">>, <<"79F954A7021B302186A950A32869DBC185523D99D3E44CE430CD1F3289F41ED4">>},
221+
{<<"cowlib">>, <<"2B3E9DA0B21C4565751A6D4901C20D1B4CC25CBB7FD50D91D2AB6DD287BC86A9">>},
224222
{<<"cpool">>, <<"430E18DF4A9D584EB1ED0D196A87CC02E878AF5B4888BFDC9B65F86A96480E30">>},
225223
{<<"credentials_obfuscation">>, <<"D28A89830E30698B075DE9A4DBE683A20685C6BED1E3B7DF744A0C06E6FF200A">>},
226-
{<<"eini">>, <<"CD604597DCDB8AD76CCBAAF8C303EF94136729BA4AD6ABC88A4AB800E6D8E99A">>},
224+
{<<"eini">>, <<"DA64AE8DB7C2F502E6F20CDF44CD3D9BE364412B87FF49FEBF282540F673DFCB">>},
227225
{<<"epgsql">>, <<"6BE4910A02551F21EAB6F6F27D97B0D4B1DFFC617F1A64C8C95FDD45652FA9E1">>},
228226
{<<"eredis">>, <<"D9B5ABEF2C2C8ABA8F32AA018203E0B3DC8B1157773B254AB1D4C2002317F1E1">>},
229227
{<<"erlang_pmp">>, <<"58EB8E466B4A1A9E841E59B0CEAB03EFD22FC195BD1B11B1FC6DAE4536DA6A16">>},
@@ -239,6 +237,7 @@
239237
{<<"jid">>, <<"D96C1223660E54549305252A3492500980505652AEB80950E201A3C446C4C9D2">>},
240238
{<<"jiffy">>, <<"F9AE986BA5A0854EB48CF6A76192D9367086DA86C20197DA430630BE7C087A4E">>},
241239
{<<"jsx">>, <<"8EE1DB1CABAFDD578A2776A6AAAE87C2A8CE54B47B59E9EC7DAB5D7EB71CD8DC">>},
240+
{<<"jwerl">>, <<"894C275CA4CF3A4F293541927CA3D7A2622B21D8BD70580EF70EACB0425F1941">>},
242241
{<<"lager">>, <<"7F904D9E87A8CB7E66156ED31768D1C8E26EBA1D54F4BC85B1AA4AC1F6340C28">>},
243242
{<<"lasse">>, <<"8081769683F73D76A718319A593F8551A0D3747404C51CCE5869CFC6AEDC7EDF">>},
244243
{<<"lhttpc">>, <<"76B5FA6149D1E10D4B1FBC4EBD51D371DB19C1AB9F0A9ECF5B526440DF064E97">>},

src/event_pusher/mod_event_pusher.erl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@
4646
%% @doc Pushes the event to each backend registered with the event_pusher.
4747
-spec push_event(mongoose_acc:t(), Host :: jid:server(), Event :: event()) -> mongoose_acc:t().
4848
push_event(Acc, Host, Event) ->
49+
{ok, HostType} = mongoose_domain_api:get_host_type(Host),
4950
lists:foldl(fun(B, Acc0) ->
5051
B:push_event(Acc0, Host, Event) end,
5152
Acc,
52-
ets:lookup_element(ets_name(Host), backends, 2)).
53+
ets:lookup_element(ets_name(HostType), backends, 2)).
5354

5455
%%--------------------------------------------------------------------
5556
%% gen_mod API

tools/print-dots.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
PIDFILE=/tmp/print-dots.pid
4-
SLEEPTIME=10s
4+
SLEEPTIME=10
55

66
loop () {
77
while true; do

0 commit comments

Comments
 (0)