Skip to content

Commit 178bde2

Browse files
committed
feat: implement asynchronous update check scheduling
Significantly decreases initial plugin startup time! By deferring the update check, lazy.nvim and the like will no longer wait for the update-check function to complete before registering as "started"
1 parent d893ed0 commit 178bde2

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lua/nvim_updater/init.lua

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -571,12 +571,14 @@ function P.setup(user_config)
571571
-- Setup Neovim user commands
572572
P.setup_usercmds()
573573

574-
-- Check for updates
574+
-- Schedule async update check
575575
if P.default_config.check_for_updates then
576-
utils.get_commit_count()
577-
if P.default_config.update_interval > 0 then
578-
utils.update_timer(P.default_config.update_interval)
579-
end
576+
vim.defer_fn(function()
577+
utils.get_commit_count()
578+
if P.default_config.update_interval > 0 then
579+
utils.update_timer(P.default_config.update_interval)
580+
end
581+
end, 50)
580582
end
581583
end
582584

0 commit comments

Comments
 (0)