From eaf0db6c5e1d560408faa7eeca17e0d0b1e47ac8 Mon Sep 17 00:00:00 2001 From: Selt <83926739+seltonmt012@users.noreply.github.com> Date: Mon, 27 Jul 2026 03:24:53 +0200 Subject: [PATCH] fix(es_extended/modules/callback): compare the promise state against its numeric value promise.state is a number, not a string - the runtime defines PENDING as 0 and Citizen.Await tests against 0 as well. Comparing it to "pending" is therefore always false and the documented 15 second timeout never rejects anything. When the other side never answers, Citizen.Await blocks the calling coroutine for good. Measured on artifact 25770 with the real 15 second delay: never answers, current guard -> state 0, not rejected, await never returns never answers, fixed guard -> state 0, rejected, await returns the timeout answers after 1s, fixed guard-> state 3, untouched, await returns normally Nothing inside esx_core calls AwaitServerCallback or AwaitClientCallback, so no core behaviour changes. --- [core]/es_extended/client/modules/callback.lua | 2 +- [core]/es_extended/server/modules/callback.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/[core]/es_extended/client/modules/callback.lua b/[core]/es_extended/client/modules/callback.lua index 30211b9a..b0dca393 100644 --- a/[core]/es_extended/client/modules/callback.lua +++ b/[core]/es_extended/client/modules/callback.lua @@ -102,7 +102,7 @@ function ESX.AwaitServerCallback(eventName, ...) -- if the server callback takes longer than 15 seconds to respond, reject the promise SetTimeout(15000, function() - if p.state == "pending" then + if p.state == 0 then p:reject("Server Callback Timed Out") end end) diff --git a/[core]/es_extended/server/modules/callback.lua b/[core]/es_extended/server/modules/callback.lua index c0fa8f73..b29347ea 100644 --- a/[core]/es_extended/server/modules/callback.lua +++ b/[core]/es_extended/server/modules/callback.lua @@ -107,7 +107,7 @@ function ESX.AwaitClientCallback(player, eventName, ...) if not p then return end SetTimeout(15000, function() - if p.state == "pending" then + if p.state == 0 then p:reject("Server Callback Timed Out") end end)