From 9fa62ea8ea935dec7078587c3664047db2065bf2 Mon Sep 17 00:00:00 2001 From: Folke Lemaitre Date: Tue, 10 Jan 2023 08:42:51 +0100 Subject: [PATCH] fix(cache): dont keep invalid entries in the cache (cleanup) --- lua/lazy/core/cache.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/lazy/core/cache.lua b/lua/lazy/core/cache.lua index e99f79e..4d5058a 100644 --- a/lua/lazy/core/cache.lua +++ b/lua/lazy/core/cache.lua @@ -144,9 +144,14 @@ function M.loader(modname) local entry = M.cache[modname] local chunk, err - if entry and M.check_path(modname, entry.modpath) then - M.stats.find.total = M.stats.find.total + 1 - chunk, err = M.load(modname, entry.modpath) + if entry then + if M.check_path(modname, entry.modpath) then + M.stats.find.total = M.stats.find.total + 1 + chunk, err = M.load(modname, entry.modpath) + else + M.cache[modname] = nil + M.dirty = true + end end if not chunk then -- find the modpath and load the module