File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1
1
const { Capi } = require ( '@tencent-sdk/capi' ) ;
2
+ const { waitResponse } = require ( '@ygkit/request' ) ;
2
3
const capis = require ( './apis/apis' ) ;
3
4
const apis = require ( './apis' ) ;
4
5
6
+ // timeout 2 minutes
7
+ const TIMEOUT = 2 * 60 * 1000 ;
8
+
5
9
class Layer {
6
10
constructor ( credentials = { } , region ) {
7
11
this . region = region || 'ap-guangzhou' ;
@@ -52,6 +56,13 @@ class Layer {
52
56
// publish layer
53
57
console . log ( `Creating layer ${ inputs . name } ` ) ;
54
58
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
+ } ) ;
55
66
console . log ( `Created layer: ${ inputs . name } , version: ${ version } successful` ) ;
56
67
outputs . version = version ;
57
68
You can’t perform that action at this time.
0 commit comments