Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(gateway): ring calls from the calls role (#3535)

Hampusa5a64afa2ebc
diff --git a/fluxer_gateway/src/gateway/fluxer_gateway_sup.erl b/fluxer_gateway/src/gateway/fluxer_gateway_sup.erl
index 7a9d8b367..8ebaa6f17 100644
--- a/fluxer_gateway/src/gateway/fluxer_gateway_sup.erl
+++ b/fluxer_gateway/src/gateway/fluxer_gateway_sup.erl
@@ -51,7 +51,7 @@ common_children() ->
-spec role_children(atom()) -> [supervisor:child_spec()].
role_children(Role) ->
RoleSpecs =
- presence_bus_children(Role) ++
+ presence_bus_children(Role) ++ push_outbox_children(Role) ++
lists:append(
[
role_child_specs(sessions, Role),
@@ -72,6 +72,15 @@ presence_bus_children(Role) ->
[]
end.
+-spec push_outbox_children(atom()) -> [supervisor:child_spec()].
+push_outbox_children(Role) ->
+ case role_enabled(push, Role) orelse role_enabled(calls, Role) of
+ true ->
+ [child_spec(push_outbox, push_outbox)];
+ false ->
+ []
+ end.
+
-spec role_child_specs(atom(), atom()) -> [supervisor:child_spec()].
role_child_specs(RoleName, Role) ->
case role_enabled(RoleName, Role) of
@@ -101,10 +110,7 @@ role_specs(guilds, _Role) ->
role_specs(calls, Role) ->
[child_spec(call_manager, call_manager)] ++ calls_voice_state_counts_sync_children(Role);
role_specs(push, _Role) ->
- [
- child_spec(push_outbox, push_outbox),
- child_spec(push, push)
- ].
+ [child_spec(push, push)].
-spec role_handoff_children(atom()) -> [supervisor:child_spec()].
role_handoff_children(Role) ->
@@ -229,6 +235,20 @@ calls_role_starts_ets_owner_before_call_workers_test() ->
?assert(owner_precedes(guild_ets_owner, call_manager, Ids)),
?assert(owner_precedes(guild_ets_owner, voice_state_counts_sync, Ids)).
+calls_role_starts_the_push_outbox_for_rings_test() ->
+ Ids = init_child_ids(#{cluster_enabled => true, gateway_role => calls}),
+ ?assertEqual(1, count_id(push_outbox, Ids)),
+ ?assert(owner_precedes(push_outbox, call_manager, Ids)).
+
+push_role_starts_the_push_outbox_before_push_test() ->
+ Ids = init_child_ids(#{cluster_enabled => true, gateway_role => push}),
+ ?assertEqual(1, count_id(push_outbox, Ids)),
+ ?assert(owner_precedes(push_outbox, push, Ids)).
+
+all_role_starts_a_single_push_outbox_test() ->
+ Ids = init_child_ids(#{cluster_enabled => true, gateway_role => all}),
+ ?assertEqual(1, count_id(push_outbox, Ids)).
+
all_role_starts_single_ets_owner_test() ->
Ids = init_child_ids(#{cluster_enabled => true, gateway_role => all}),
?assertEqual(1, count_id(guild_ets_owner, Ids)).