Skip to content

Commit 8000eef

Browse files
committed
fix(layer): add loop get status
1 parent f45d9de commit 8000eef

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/modules/layer/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
const { Capi } = require('@tencent-sdk/capi');
2+
const { waitResponse } = require('@ygkit/request');
23
const capis = require('./apis/apis');
34
const apis = require('./apis');
45

6+
// timeout 2 minutes
7+
const TIMEOUT = 2 * 60 * 1000;
8+
59
class Layer {
610
constructor(credentials = {}, region) {
711
this.region = region || 'ap-guangzhou';
@@ -52,6 +56,13 @@ class Layer {
5256
// publish layer
5357
console.log(`Creating layer ${inputs.name}`);
5458
const version = await apis.publishLayer(this.capi, layerInputs);
59+
// loop for active status
60+
await waitResponse({
61+
callback: async () => this.getLayerDetail(inputs.name, version),
62+
targetProp: 'Status',
63+
targetResponse: 'Active',
64+
timeout: TIMEOUT,
65+
});
5566
console.log(`Created layer: ${inputs.name}, version: ${version} successful`);
5667
outputs.version = version;
5768

0 commit comments

Comments
 (0)