File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ const CONFIGS = {
2
2
defaultNamespace : 'default' ,
3
3
defaultMemorySize : 128 ,
4
4
defaultTimeout : 3 ,
5
+ waitStatus : [ 'Creating' , 'Updating' , 'Publishing' ] ,
5
6
} ;
6
7
7
8
module . exports = CONFIGS ;
Original file line number Diff line number Diff line change @@ -90,9 +90,10 @@ class Scf {
90
90
// because craeting function is asynchronous
91
91
async checkStatus ( namespace , functionName ) {
92
92
console . log ( `Checking function ${ functionName } status ...` ) ;
93
- let status = 'Updating' ;
93
+ const initialInfo = await this . getFunction ( namespace , functionName ) ;
94
+ let status = initialInfo . Status ;
94
95
let times = 200 ;
95
- while ( ( status === 'Updating' || status === 'Creating' ) && times > 0 ) {
96
+ while ( CONFIGS . waitStatus . indexOf ( status ) !== - 1 && times > 0 ) {
96
97
const tempFunc = await this . getFunction ( namespace , functionName ) ;
97
98
status = tempFunc . Status ;
98
99
await sleep ( 300 ) ;
You can’t perform that action at this time.
0 commit comments