Skip to content

Commit df5b4a6

Browse files
committed
fix(scf): publishing status check
1 parent d89e6ac commit df5b4a6

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/modules/scf/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const CONFIGS = {
22
defaultNamespace: 'default',
33
defaultMemorySize: 128,
44
defaultTimeout: 3,
5+
waitStatus: ['Creating', 'Updating', 'Publishing'],
56
};
67

78
module.exports = CONFIGS;

src/modules/scf/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ class Scf {
9090
// because craeting function is asynchronous
9191
async checkStatus(namespace, functionName) {
9292
console.log(`Checking function ${functionName} status ...`);
93-
let status = 'Updating';
93+
const initialInfo = await this.getFunction(namespace, functionName);
94+
let status = initialInfo.Status;
9495
let times = 200;
95-
while ((status === 'Updating' || status === 'Creating') && times > 0) {
96+
while (CONFIGS.waitStatus.indexOf(status) !== -1 && times > 0) {
9697
const tempFunc = await this.getFunction(namespace, functionName);
9798
status = tempFunc.Status;
9899
await sleep(300);

0 commit comments

Comments
 (0)