test(gateway): keep the recheck timer out of the eunit process (#3304)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-08 18:14:47 +02:00
1 parent ccbe4857a1
commit 0ec1cee99e
2 files changed
+11 -3

No files matched your search

@@ -269,8 +269,16 @@ schedule_availability_recheck_available_no_timer_test() ->
schedule_availability_recheck_unavailable_sets_timer_test() ->
State = #{data => #{<<"guild">> => #{<<"features">> => [<<"UNAVAILABLE_FOR_EVERYONE">>]}}},
Result = schedule_availability_recheck(State),
?assertEqual(State, Result).
Parent = self(),
{Pid, MonitorRef} = spawn_monitor(fun() ->
Parent ! {scheduled, self(), schedule_availability_recheck(State)}
end),
receive
{scheduled, Pid, Result} -> ?assertEqual(State, Result)
end,
receive
{'DOWN', MonitorRef, process, Pid, normal} -> ok
end.
handle_recheck_transition_clears_cache_on_recovery_test() ->
GuildId = 99001,
@@ -777,7 +777,7 @@ reference_update_member_subscriptions(SessionId, MemberIds, State) ->
drain_mailbox(Acc) ->
receive
Msg -> drain_mailbox([Msg | Acc])
{'$gen_cast', _} = Msg -> drain_mailbox([Msg | Acc])
after 50 -> lists:reverse(Acc)
end.