From 5f7da63fbbf716dae9e21ea2be4bd57bdf713a1a Mon Sep 17 00:00:00 2001 From: Rocky28447 <26193486+Rocky28447@users.noreply.github.com> Date: Mon, 12 Nov 2018 16:46:51 -0500 Subject: [PATCH] Changed logic slightly :+1: --- .../Aero/Services/DataService.modulescript.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ServerStorage/Aero/Services/DataService.modulescript.lua b/src/ServerStorage/Aero/Services/DataService.modulescript.lua index 7fedbc9..c1df0ef 100644 --- a/src/ServerStorage/Aero/Services/DataService.modulescript.lua +++ b/src/ServerStorage/Aero/Services/DataService.modulescript.lua @@ -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 @@ -240,7 +241,7 @@ function DataService:FlushAllConcurrent() end) end globalCache:FlushAll() - if (numCaches > 0) then coroutine.yield() end + coroutine.yield() end @@ -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() @@ -282,7 +284,7 @@ function DataService:Start() end end)() end - if (numBinded > 0) then coroutine.yield() end + coroutine.yield() end -- Flush cache: