File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ class MainServer {
137137 /**
138138 * 确认服务是否可用
139139 */
140- private async checkServerIsReady ( ) {
140+ private async checkServerIsReady ( logError : boolean = false ) {
141141 try {
142142 await new Promise ( ( resolve , reject ) => {
143143 const res = get ( `http://localhost:${ this . port } /api/v1/info` , ( resp ) => {
@@ -159,6 +159,7 @@ class MainServer {
159159 } ) ;
160160 } ) . on ( 'error' , ( err ) => {
161161 log . info ( 'check server with resp err' ) ;
162+ logError && log . info ( err ) ;
162163 reject ( err ) ;
163164 } ) ;
164165 res . setTimeout ( 2000 ) ;
@@ -179,7 +180,7 @@ class MainServer {
179180 const getStatus = async ( fn , reject ) => {
180181 count ++ ;
181182 log . info ( `fetch server status count(${ count } )` ) ;
182- const isReady = await this . checkServerIsReady ( ) ;
183+ const isReady = await this . checkServerIsReady ( count > 70 ) ;
183184 if ( isReady ) {
184185 log . info ( `Server startup time:` , ( Date . now ( ) - now ) / 1000 ) ;
185186 fn ( true ) ;
You can’t perform that action at this time.
0 commit comments