From deff8f8b9476e81358ac5dc67ff22f1082e80c1f Mon Sep 17 00:00:00 2001 From: mozhou52 Date: Tue, 15 Oct 2024 16:49:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:fc3=20sync=20=E6=8C=87=E4=BB=A4=EF=BC=8C?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E5=8C=85=E5=90=AB=20asyncinvokeconfig,=20pro?= =?UTF-8?q?vision=20=E5=92=8C=20concurrency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/subCommands/sync/index.ts | 42 +++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/src/subCommands/sync/index.ts b/src/subCommands/sync/index.ts index 303d0b8..f61df88 100644 --- a/src/subCommands/sync/index.ts +++ b/src/subCommands/sync/index.ts @@ -86,6 +86,8 @@ export default class Sync { const triggers = await this.getTriggers(); let asyncInvokeConfig = {}; let vpcBindingConfig = {}; + let concurrencyConfig = {}; + let provisionConfig = {}; try { asyncInvokeConfig = await this.fcSdk.getAsyncInvokeConfig( this.functionName, @@ -96,6 +98,18 @@ export default class Sync { // eslint-disable-next-line no-empty } + try { + provisionConfig = await this.fcSdk.getFunctionProvisionConfig(this.functionName, 'LATEST'); + } catch (ex) { + // eslint-disable-next-line no-empty + } + + try { + concurrencyConfig = await this.fcSdk.getFunctionConcurrency(this.functionName); + } catch (ex) { + // eslint-disable-next-line no-empty + } + try { vpcBindingConfig = await this.fcSdk.getVpcBinding( this.functionName, @@ -104,10 +118,24 @@ export default class Sync { } catch (ex) { // eslint-disable-next-line no-empty } - return await this.write(functionInfo, triggers, asyncInvokeConfig, vpcBindingConfig); + return await this.write( + functionInfo, + triggers, + asyncInvokeConfig, + vpcBindingConfig, + concurrencyConfig, + provisionConfig, + ); } - async write(functionConfig: any, triggers: any, asyncInvokeConfig: any, vpcBindingConfig: any) { + async write( + functionConfig: any, + triggers: any, + asyncInvokeConfig: any, + vpcBindingConfig: any, + concurrencyConfig: any, + provisionConfig: any, + ) { const syncFolderName = 'sync-clone'; const baseDir = this.target @@ -156,6 +184,16 @@ export default class Sync { if (!_.isEmpty(asyncInvokeConfig)) { props.asyncInvokeConfig = asyncInvokeConfig; } + if (!_.isEmpty(provisionConfig)) { + _.unset(provisionConfig, 'current'); + _.unset(provisionConfig, 'currentError'); + _.unset(provisionConfig, 'functionArn'); + props.provisionConfig = provisionConfig; + } + if (!_.isEmpty(concurrencyConfig)) { + _.unset(concurrencyConfig, 'functionArn'); + props.concurrencyConfig = concurrencyConfig; + } if (!_.isEmpty(vpcBindingConfig)) { const vpcIds = _.get(functionConfig.vpcBinding, 'vpcIds', []);