[skip ci] fix: startup issues in gateway
This commit is contained in:
parent
fda2962148
commit
22ba6945ed
@ -25,6 +25,7 @@ start(_StartType, _StartArgs) ->
|
|||||||
otel_metrics:init(),
|
otel_metrics:init(),
|
||||||
passive_sync_registry:init(),
|
passive_sync_registry:init(),
|
||||||
guild_counts_cache:init(),
|
guild_counts_cache:init(),
|
||||||
|
{ok, Pid} = fluxer_gateway_sup:start_link(),
|
||||||
Port = fluxer_gateway_env:get(port),
|
Port = fluxer_gateway_env:get(port),
|
||||||
Dispatch = cowboy_router:compile([
|
Dispatch = cowboy_router:compile([
|
||||||
{'_', [
|
{'_', [
|
||||||
@ -37,7 +38,7 @@ start(_StartType, _StartArgs) ->
|
|||||||
env => #{dispatch => Dispatch},
|
env => #{dispatch => Dispatch},
|
||||||
max_frame_size => 4096
|
max_frame_size => 4096
|
||||||
}),
|
}),
|
||||||
fluxer_gateway_sup:start_link().
|
{ok, Pid}.
|
||||||
|
|
||||||
-spec stop(term()) -> ok.
|
-spec stop(term()) -> ok.
|
||||||
stop(_State) ->
|
stop(_State) ->
|
||||||
|
|||||||
@ -67,7 +67,7 @@ handle_presence_connect(Attempt, State) ->
|
|||||||
group_dm_recipients => GroupDmRecipients,
|
group_dm_recipients => GroupDmRecipients,
|
||||||
custom_status => maps:get(custom_status, State, null)
|
custom_status => maps:get(custom_status, State, null)
|
||||||
}},
|
}},
|
||||||
case gen_server:call(presence_manager, Message, 5000) of
|
try gen_server:call(presence_manager, Message, 5000) of
|
||||||
{ok, Pid} ->
|
{ok, Pid} ->
|
||||||
try_presence_session_connect(
|
try_presence_session_connect(
|
||||||
Pid,
|
Pid,
|
||||||
@ -83,6 +83,13 @@ handle_presence_connect(Attempt, State) ->
|
|||||||
);
|
);
|
||||||
_ ->
|
_ ->
|
||||||
schedule_presence_retry(Attempt, State)
|
schedule_presence_retry(Attempt, State)
|
||||||
|
catch
|
||||||
|
exit:{noproc, _} ->
|
||||||
|
schedule_presence_retry(Attempt, State);
|
||||||
|
exit:{normal, _} ->
|
||||||
|
schedule_presence_retry(Attempt, State);
|
||||||
|
_:_ ->
|
||||||
|
schedule_presence_retry(Attempt, State)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec try_presence_session_connect(
|
-spec try_presence_session_connect(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user