From 6a17dac71485d759740f3263f701054bf8843713 Mon Sep 17 00:00:00 2001 From: rootiest Date: Fri, 9 Aug 2024 05:36:04 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf(cache=5Fstats):=20ens?= =?UTF-8?q?ure=20only=20one=20instance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ensures only a single instance of the cache_stats script is active --- lua/utils/cache_stats.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lua/utils/cache_stats.lua b/lua/utils/cache_stats.lua index fa84709..d9a1cc2 100644 --- a/lua/utils/cache_stats.lua +++ b/lua/utils/cache_stats.lua @@ -7,11 +7,18 @@ local M = {} local config_dir = vim.fn.stdpath("config") local cache_script = config_dir .. "/scripts/update_cache.sh" +-- Flag to check if the script has already been run +local script_run_once = false + -- Function to run the cache update script using vim.system function M.setup_script() - vim.system({ cache_script }, { detach = true }, function() end) + if not script_run_once then + vim.system({ cache_script }, { detach = true }, function() end) + script_run_once = true + end end +-- Run the setup script only once M.setup_script() return M