Skip to content

Commit

Permalink
Run StyLua on scheduler (#121)
Browse files Browse the repository at this point in the history
* Run StyLua on scheduler
* Altered line width to 90
  • Loading branch information
RoFlection Bot committed Jun 26, 2021
1 parent 4247e4c commit 78c0596
Show file tree
Hide file tree
Showing 12 changed files with 498 additions and 527 deletions.
44 changes: 23 additions & 21 deletions modules/scheduler/src/Scheduler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ return function(hostConfig)
timer.sortIndex = timer.expirationTime
push(taskQueue, timer)
if enableProfiling then
markTaskStart(timer, currentTime);
timer.isQueued = true;
markTaskStart(timer, currentTime)
timer.isQueued = true
end
else
-- Remaining timers are pending.
return;
return
end

timer = peek(timerQueue)
Expand All @@ -121,7 +121,7 @@ return function(hostConfig)
else
local firstTimer = peek(timerQueue)
if firstTimer ~= nil then
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime)
end
end
end
Expand Down Expand Up @@ -193,11 +193,13 @@ return function(hostConfig)
local currentTime = initialTime
advanceTimers(currentTime)
currentTask = peek(taskQueue)
while currentTask ~= nil and
not (enableSchedulerDebugging and isSchedulerPaused) do
while
currentTask ~= nil
and not (enableSchedulerDebugging and isSchedulerPaused)
do
if
currentTask.expirationTime > currentTime and
(not hasTimeRemaining or shouldYieldToHost())
currentTask.expirationTime > currentTime
and (not hasTimeRemaining or shouldYieldToHost())
then
-- This currentTask hasn't expired, and we've reached the deadline.
break
Expand Down Expand Up @@ -247,11 +249,11 @@ return function(hostConfig)

local function unstable_runWithPriority(priorityLevel, eventHandler)
if
priorityLevel == ImmediatePriority or
priorityLevel == UserBlockingPriority or
priorityLevel == NormalPriority or
priorityLevel == LowPriority or
priorityLevel == IdlePriority
priorityLevel == ImmediatePriority
or priorityLevel == UserBlockingPriority
or priorityLevel == NormalPriority
or priorityLevel == LowPriority
or priorityLevel == IdlePriority
then
-- Leave priority alone if assigned
else
Expand Down Expand Up @@ -283,9 +285,9 @@ return function(hostConfig)
local function unstable_next(eventHandler)
local priorityLevel
if
currentPriorityLevel == ImmediatePriority or
currentPriorityLevel == UserBlockingPriority or
currentPriorityLevel == NormalPriority
currentPriorityLevel == ImmediatePriority
or currentPriorityLevel == UserBlockingPriority
or currentPriorityLevel == NormalPriority
then
-- Shift down to normal priority
priorityLevel = NormalPriority
Expand Down Expand Up @@ -375,7 +377,7 @@ return function(hostConfig)
timeout = NORMAL_PRIORITY_TIMEOUT
end

local expirationTime = startTime + timeout;
local expirationTime = startTime + timeout

local newTask = {
id = taskIdCounter,
Expand All @@ -388,7 +390,7 @@ return function(hostConfig)
taskIdCounter += 1

if enableProfiling then
newTask.isQueued = false;
newTask.isQueued = false
end

if startTime > currentTime then
Expand Down Expand Up @@ -445,9 +447,9 @@ return function(hostConfig)
local function unstable_cancelCallback(task)
if enableProfiling then
if task.isQueued then
local currentTime = getCurrentTime()
markTaskCanceled(task, currentTime)
task.isQueued = false;
local currentTime = getCurrentTime()
markTaskCanceled(task, currentTime)
task.isQueued = false
end
end

Expand Down
8 changes: 4 additions & 4 deletions modules/scheduler/src/SchedulerFeatureFlags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
]]

return {
enableSchedulerDebugging = false,
enableIsInputPending = false,
enableProfiling = _G.__PROFILE__
}
enableSchedulerDebugging = false,
enableIsInputPending = false,
enableProfiling = _G.__PROFILE__,
}
2 changes: 1 addition & 1 deletion modules/scheduler/src/SchedulerMinHeap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ end
siftUp = function(heap: Heap, node: Node, index: number): ()
while true do
local parentIndex = math.floor(index / 2)
local parent = heap[parentIndex];
local parent = heap[parentIndex]
if parent ~= nil and compare(parent :: Node, node :: Node) > 0 then
-- The parent is larger. Swap positions.
heap[parentIndex] = node
Expand Down
Loading

0 comments on commit 78c0596

Please sign in to comment.