Skip to content
This repository has been archived by the owner on Jul 28, 2022. It is now read-only.

Commit

Permalink
Changed logic slightly
Browse files Browse the repository at this point in the history
👍
  • Loading branch information
ThoughtSpinnr authored Nov 12, 2018
1 parent 30f89a3 commit 5f7da63
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ServerStorage/Aero/Services/DataService.modulescript.lua
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ function DataService:FlushAllConcurrent()
for _,cache in pairs(customCaches) do
numCaches = (numCaches + 1)
end
if (numCaches == 0) then return end
local function IncFlushed()
numFlushed = (numFlushed + 1)
if (numFlushed == numCaches) then
Expand All @@ -240,7 +241,7 @@ function DataService:FlushAllConcurrent()
end)
end
globalCache:FlushAll()
if (numCaches > 0) then coroutine.yield() end
coroutine.yield()
end


Expand Down Expand Up @@ -270,6 +271,7 @@ function DataService:Start()
local function FireBoundToCloseCallbacks()
local thread = coroutine.running()
local numBinded = #boundToCloseFuncs
if (numCaches == 0) then return end
local numCompleted = 0
local maxWait = 20
local start = tick()
Expand All @@ -282,7 +284,7 @@ function DataService:Start()
end
end)()
end
if (numBinded > 0) then coroutine.yield() end
coroutine.yield()
end

-- Flush cache:
Expand Down

0 comments on commit 5f7da63

Please sign in to comment.