mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-25 08:00:03 +00:00
mprove Promise.delay accuracy
This commit is contained in:
parent
266e265e20
commit
fc134adb73
1 changed files with 3 additions and 3 deletions
|
@ -629,9 +629,10 @@ do
|
||||||
first = node
|
first = node
|
||||||
connection = Promise._timeEvent:Connect(function()
|
connection = Promise._timeEvent:Connect(function()
|
||||||
local currentTime = Promise._getTime()
|
local currentTime = Promise._getTime()
|
||||||
|
|
||||||
while first.endTime <= currentTime do
|
while first.endTime <= currentTime do
|
||||||
first.resolve(currentTime - first.startTime)
|
-- Don't use currentTime here, as this is the time when we started resolving,
|
||||||
|
-- not necessarily the time *right now*.
|
||||||
|
first.resolve(Promise._getTime() - first.startTime)
|
||||||
first = first.next
|
first = first.next
|
||||||
if first == nil then
|
if first == nil then
|
||||||
connection:Disconnect()
|
connection:Disconnect()
|
||||||
|
@ -639,7 +640,6 @@ do
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
first.previous = nil
|
first.previous = nil
|
||||||
currentTime = Promise._getTime()
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else -- first is non-nil
|
else -- first is non-nil
|
||||||
|
|
Loading…
Reference in a new issue