@@ -45,7 +45,16 @@ export default class ProfileStatusWatcher {
45
45
return { label : `Worker nodes: ${ this . workerReadiness } ` }
46
46
}
47
47
48
+ private async initJobWithDelay ( profile : string , delayMillis = 0 ) {
49
+ if ( delayMillis ) {
50
+ // delayed start
51
+ await new Promise ( ( resolve ) => setTimeout ( resolve , delayMillis ) )
52
+ }
53
+ return this . initJob ( profile )
54
+ }
55
+
48
56
private initJob ( profile : string ) {
57
+ console . error ( "Watcher start" , profile )
49
58
const { argv, env } = respawnCommand ( [
50
59
"guide" ,
51
60
"-q" ,
@@ -72,12 +81,15 @@ export default class ProfileStatusWatcher {
72
81
} )
73
82
74
83
job . on ( "error" , ( ) => {
84
+ Debug ( "codeflare" ) ( "Watcher error" , profile )
75
85
this . headReadiness = "error"
76
86
this . workerReadiness = "error"
87
+ this . initJobWithDelay ( profile , 2000 ) // restart after a delay
77
88
} )
78
89
79
- job . on ( "close" , ( exitCode ) => {
80
- console . error ( "Watcher exited with code" , exitCode )
90
+ job . on ( "close" , async ( exitCode ) => {
91
+ Debug ( "codeflare" ) ( "Watcher exited with code" , exitCode )
92
+ this . initJobWithDelay ( profile , 2000 ) // restart after a delay
81
93
} )
82
94
83
95
job . stdout . on ( "data" , ( data ) => {
0 commit comments