Skip to content

Commit

Permalink
fix(server/events): possibly fix deferral hangs (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID committed Jan 9, 2024
1 parent 98efa4d commit a205d95
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ local function onPlayerConnecting(name, _, deferrals)
local success, err = pcall(function()
local isBanned, Reason = IsPlayerBanned(src --[[@as Source]])
if isBanned then
Wait(0) -- Mandatory wait
deferrals.done(Reason)
end
end)
Expand All @@ -98,6 +99,7 @@ local function onPlayerConnecting(name, _, deferrals)
deferrals.update(string.format(Lang:t('info.checking_whitelisted'), name))
success, err = pcall(function()
if not IsWhitelisted(src --[[@as Source]]) then
Wait(0) -- Mandatory wait
deferrals.done(Lang:t('error.not_whitelisted'))
end
end)
Expand All @@ -112,6 +114,10 @@ local function onPlayerConnecting(name, _, deferrals)
-- wait for database to finish
databasePromise:next(function()
deferrals.update(string.format(Lang:t('info.join_server'), name))

-- Mandatory wait
Wait(0)

if queue then
queue.awaitPlayerQueue(src --[[@as Source]], license, deferrals)
else
Expand Down

0 comments on commit a205d95

Please sign in to comment.