From 7e5b7503d2c84a5fbc190f85e38a523c7fe24edb Mon Sep 17 00:00:00 2001 From: MCorange Date: Sun, 25 Aug 2024 23:05:38 +0300 Subject: [PATCH] :3 --- rtmc.lua | 6 ++++-- src/updater.lua | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/rtmc.lua b/rtmc.lua index 5aa9708..5a3bc3d 100644 --- a/rtmc.lua +++ b/rtmc.lua @@ -377,8 +377,10 @@ rawset(__BUNDLER_FILES, "updater", function () end function updater:check(branch) local curr = os.time(); - if not ((math.abs(curr - self.last_check) >= self.threshold) and (self.curr_commit_hash ~= "")) then - return false; + if math.abs(curr - self.last_check) < self.threshold then + if self.curr_commit_hash ~= "" then + return false; + end end self.last_check = curr; local req, rerr = http.get(self.api_url .. "/commits?sha="..branch); diff --git a/src/updater.lua b/src/updater.lua index 3b14df2..e323d0f 100644 --- a/src/updater.lua +++ b/src/updater.lua @@ -56,9 +56,10 @@ end function updater:check(branch) local curr = os.time(); - if not ((math.abs(curr - self.last_check) >= self.threshold) and (self.curr_commit_hash ~= "")) then - -- log.debug("Not time for an update yet"); - return false; + if math.abs(curr - self.last_check) < self.threshold then + if self.curr_commit_hash ~= "" then + return false; + end end self.last_check = curr;