@@ -474,10 +474,20 @@ export const handlers = makeHandlers({
474474 project_id : project . id ,
475475 ...pick ( body , 'name' , 'description' , 'hostname' , 'memory' , 'ncpus' ) ,
476476 ...getTimestamps ( ) ,
477- run_state : 'running ' ,
477+ run_state : 'creating ' ,
478478 time_run_state_updated : new Date ( ) . toISOString ( ) ,
479479 }
480+
481+ setTimeout ( ( ) => {
482+ newInstance . run_state = 'starting'
483+ } , 1000 )
484+
485+ setTimeout ( ( ) => {
486+ newInstance . run_state = 'running'
487+ } , 5000 )
488+
480489 db . instances . push ( newInstance )
490+
481491 return json ( newInstance , { status : 201 } )
482492 } ,
483493 instanceView : ( { path, query } ) => lookup . instance ( { ...path , ...query } ) ,
@@ -599,7 +609,7 @@ export const handlers = makeHandlers({
599609
600610 setTimeout ( ( ) => {
601611 instance . run_state = 'running'
602- } , 3000 )
612+ } , 1000 )
603613
604614 return json ( instance , { status : 202 } )
605615 } ,
@@ -609,13 +619,21 @@ export const handlers = makeHandlers({
609619 } ,
610620 instanceStart ( { path, query } ) {
611621 const instance = lookup . instance ( { ...path , ...query } )
612- instance . run_state = 'running'
622+ instance . run_state = 'starting'
623+
624+ setTimeout ( ( ) => {
625+ instance . run_state = 'running'
626+ } , 1000 )
613627
614628 return json ( instance , { status : 202 } )
615629 } ,
616630 instanceStop ( { path, query } ) {
617631 const instance = lookup . instance ( { ...path , ...query } )
618- instance . run_state = 'stopped'
632+ instance . run_state = 'stopping'
633+
634+ setTimeout ( ( ) => {
635+ instance . run_state = 'stopped'
636+ } , 1000 )
619637
620638 return json ( instance , { status : 202 } )
621639 } ,
0 commit comments