From 039fad1614c543ea9377b8f12702b2e2d307b3e2 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Mon, 22 Sep 2025 16:32:52 -0400 Subject: [PATCH] fix(cache): cache contest data indefinitely --- lua/cp/cache.lua | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lua/cp/cache.lua b/lua/cp/cache.lua index c59fc61..dbfb160 100644 --- a/lua/cp/cache.lua +++ b/lua/cp/cache.lua @@ -45,19 +45,6 @@ local CONTEST_LIST_TTL = { atcoder = 24 * 60 * 60, -- 1 day } ----@param platform string ----@return number? -local function get_expiry_date(platform) - vim.validate({ - platform = { platform, 'string' }, - }) - - if platform == 'cses' then - return os.time() + (30 * 24 * 60 * 60) - end - return nil -end - ---@param contest_data ContestData ---@param platform string ---@return boolean @@ -67,16 +54,7 @@ local function is_cache_valid(contest_data, platform) platform = { platform, 'string' }, }) - if platform ~= 'cses' then - return true - end - - local expires_at = contest_data.expires_at - if not expires_at then - return false - end - - return os.time() < expires_at + return true end function M.load() @@ -154,7 +132,6 @@ function M.set_contest_data(platform, contest_id, problems) cache_data[platform][contest_id] = { problems = problems, scraped_at = os.date('%Y-%m-%d'), - expires_at = get_expiry_date(platform), } M.save()