mirror of
https://github.com/AmberGraceRblx/luau-promise.git
synced 2025-04-24 15:50:01 +00:00
Allow OnCancel to break out of the current loop
This commit is contained in:
parent
9db73644e6
commit
3a96a1d2a7
1 changed files with 3 additions and 2 deletions
|
@ -715,7 +715,9 @@ do
|
|||
if connection == nil then -- first is nil when connection is nil
|
||||
first = node
|
||||
connection = Promise._timeEvent:Connect(function()
|
||||
while first.endTime <= Promise._getTime() do
|
||||
local threadStart = Promise._getTime()
|
||||
|
||||
while first ~= nil and first.endTime < threadStart do
|
||||
local current = first
|
||||
first = current.next
|
||||
|
||||
|
@ -727,7 +729,6 @@ do
|
|||
end
|
||||
|
||||
current.resolve(Promise._getTime() - current.startTime)
|
||||
if current.next == nil then return end -- kill this thread if there was no `first` before `resolve`
|
||||
end
|
||||
end)
|
||||
else -- first is non-nil
|
||||
|
|
Loading…
Reference in a new issue