⚡️ perf(cache_stats): ensure only one instance
Ensures only a single instance of the cache_stats script is active
This commit is contained in:
@@ -7,11 +7,18 @@ local M = {}
|
|||||||
local config_dir = vim.fn.stdpath("config")
|
local config_dir = vim.fn.stdpath("config")
|
||||||
local cache_script = config_dir .. "/scripts/update_cache.sh"
|
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 to run the cache update script using vim.system
|
||||||
function M.setup_script()
|
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
|
end
|
||||||
|
|
||||||
|
-- Run the setup script only once
|
||||||
M.setup_script()
|
M.setup_script()
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
Reference in New Issue
Block a user