@@ -270,50 +270,15 @@ func init() {
270270func startup (scrollService * services.ScrollService , processLauncher * services.ProcedureLauncher , queueManager * services.QueueManager , portSerivce * services.PortMonitor , coldStarter * services.ColdStarter , healthHandler * handler.HealthHandler , cwd string , doneChan chan error ) {
271271
272272 healthHandler .Started = true
273-
274273 currentScroll := scrollService .GetCurrent ()
275274
276- lock , err := scrollService .Bootstrap (ignoreVersionCheck )
277- if err != nil {
278- doneChan <- err
279- return
280- }
281-
282- newScroll := len (lock .Statuses ) == 0
283-
284- if newScroll {
285- logger .Log ().Info ("No lock file found, but init command available. Bootstrapping..." )
286-
287- logger .Log ().Info ("Creating lock and bootstrapping files" )
288- //There is an error here. We need to bootstrap the files before we render out the templates in the bootstrap func above
289- err := scrollService .CreateLockAndBootstrapFiles ()
290- if err != nil {
291- doneChan <- err
292- return
293- }
294- } else {
295- logger .Log ().Info ("Found lock file, bootstrapping done" )
296- }
297-
298- logger .Log ().Info ("Rendering cwd templates" )
299- err = scrollService .RenderCwdTemplates ()
300- if err != nil {
301- doneChan <- err
302- return
303- }
304-
305- logger .Log ().Info ("Launching plugins" )
306- //important to launch plugins, after the templates are rendered, sothat templates can provide for plugins
307- err = processLauncher .LaunchPlugins ()
275+ newScroll , err := initScroll (scrollService , processLauncher , queueManager )
308276
309277 if err != nil {
310278 doneChan <- err
311279 return
312280 }
313281
314- logger .Log ().Info ("Starting queue manager" )
315- go queueManager .Work ()
316-
317282 if newScroll {
318283 logger .Log ().Info ("Starting scroll.init process" )
319284 //start scroll.init process
@@ -375,3 +340,45 @@ func startup(scrollService *services.ScrollService, processLauncher *services.Pr
375340 doneChan <- nil
376341
377342}
343+
344+ func initScroll (scrollService * services.ScrollService , processLauncher * services.ProcedureLauncher , queueManager * services.QueueManager ) (bool , error ) {
345+
346+ lock , err := scrollService .Bootstrap (ignoreVersionCheck )
347+ if err != nil {
348+ return false , err
349+ }
350+
351+ newScroll := len (lock .Statuses ) == 0
352+
353+ if newScroll {
354+ logger .Log ().Info ("No lock file found, but init command available. Bootstrapping..." )
355+
356+ logger .Log ().Info ("Creating lock and bootstrapping files" )
357+ //There is an error here. We need to bootstrap the files before we render out the templates in the bootstrap func above
358+ err := scrollService .CreateLockAndBootstrapFiles ()
359+ if err != nil {
360+ return newScroll , err
361+ }
362+ } else {
363+ logger .Log ().Info ("Found lock file, bootstrapping done" )
364+ }
365+
366+ logger .Log ().Info ("Rendering cwd templates" )
367+ err = scrollService .RenderCwdTemplates ()
368+ if err != nil {
369+ return newScroll , err
370+ }
371+
372+ logger .Log ().Info ("Launching plugins" )
373+ //important to launch plugins, after the templates are rendered, sothat templates can provide for plugins
374+ err = processLauncher .LaunchPlugins ()
375+
376+ if err != nil {
377+ return newScroll , err
378+ }
379+
380+ logger .Log ().Info ("Starting queue manager" )
381+ go queueManager .Work ()
382+
383+ return newScroll , nil
384+ }
0 commit comments