From fc134adb73ae7b22ce79e1c526c43fcbf7e41dda Mon Sep 17 00:00:00 2001 From: Eryn Lynn Date: Mon, 11 May 2020 15:43:50 -0400 Subject: [PATCH] mprove Promise.delay accuracy --- lib/init.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/init.lua b/lib/init.lua index 82352bd..31c7ee1 100644 --- a/lib/init.lua +++ b/lib/init.lua @@ -629,9 +629,10 @@ do first = node connection = Promise._timeEvent:Connect(function() local currentTime = Promise._getTime() - 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 if first == nil then connection:Disconnect() @@ -639,7 +640,6 @@ do break end first.previous = nil - currentTime = Promise._getTime() end end) else -- first is non-nil