@@ -24,7 +24,7 @@ vim.g.pm_loaded = 0
2424local DEFAULT_SETTINGS = {
2525 max_concurrent_tasks = if_nil (vim .g .strive_max_concurrent_tasks , 5 ),
2626 auto_install = if_nil (vim .g .strive_auto_install , true ),
27- log_level = if_nil (vim .g .strive_log_level , ' info ' ),
27+ log_level = if_nil (vim .g .strive_log_level , ' debug ' ),
2828 git_timeout = if_nil (vim .g .strive_git_timeout , 60000 ),
2929}
3030
@@ -135,18 +135,28 @@ end
135135
136136-- Process the queue, starting as many tasks as allowed
137137function TaskQueue :process ()
138+ M .log (
139+ ' debug' ,
140+ string.format (' TaskQueue status: %d queued, %d active' , # self .queue , self .active_tasks )
141+ )
142+ print (vim .inspect (self .queue ))
143+
138144 if # self .queue == 0 and self .active_tasks == 0 and self .on_empty then
145+ M .log (' info' , ' All tasks completed, calling on_empty callback' )
139146 self .on_empty ()
140147 return
141148 end
142-
149+ M .log (
150+ ' debug' ,
151+ string.format (' Starting new task, active: %d, queued: %d' , self .active_tasks , # self .queue )
152+ )
143153 while self .active_tasks < self .max_concurrent and # self .queue > 0 do
144154 local task = table.remove (self .queue , 1 )
145155 self .active_tasks = self .active_tasks + 1
146156
147157 task (function ()
148158 self .active_tasks = self .active_tasks - 1
149- self :process () -- Continue processing after task completes
159+ self :process ()
150160 end )
151161 end
152162end
@@ -700,6 +710,7 @@ function Plugin:install()
700710 end
701711
702712 return Async .wrap (function (callback )
713+ print (callback )
703714 -- Check if already installed
704715 local installed = Async .await (self :is_installed ())
705716 if installed then
@@ -726,7 +737,7 @@ function Plugin:install()
726737 end
727738 end ,
728739 }, function (obj )
729- -- Use schedule for UI updates in callbacks
740+ callback ( obj . code == 0 )
730741 vim .schedule (function ()
731742 if obj .code == 0 then
732743 self .status = STATUS .INSTALLED
@@ -743,16 +754,13 @@ function Plugin:install()
743754 vim .cmd (self .build_action )
744755 end )
745756 end
746-
747- callback (true )
748757 else
749758 self .status = STATUS .ERROR
750759 ui :update_entry (
751760 self .name ,
752761 self .status ,
753762 ' Failed: ' .. (obj .stderr or ' Unknown error' ) .. ' code: ' .. obj .code
754763 )
755- callback (false )
756764 end
757765 end )
758766 end )
0 commit comments