Skip to content

Commit f8a1359

Browse files
Rong5180rongxwang
andauthored
Feat/scf concurrent (#79)
* feat: 增加预置并发功能 * fix: modify test file * feat: add preset concurrency * feat: add preset concurrency * feat: 支持websocket Co-authored-by: rongxwang <rongxwang@tencent.com>
1 parent 4754ca0 commit f8a1359

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

serverless.component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: scf
2-
version: 0.8.5
2+
version: 0.8.6
33
author: Tencent Cloud, Inc.
44
org: Tencent Cloud, Inc.
55
description: 单函数组件,允许用户开发部署单个腾讯 SCF 函数实例。适合进行单一函数开发的场景。如:定时触发任务。

src/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"dependencies": {
33
"adm-zip": "^0.5.5",
44
"download": "^8.0.0",
5-
"tencent-component-toolkit": "^2.14.0",
5+
"tencent-component-toolkit": "^2.22.0",
66
"type": "^2.0.0"
77
}
88
}

src/serverless.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class ServerlessComponent extends Component {
4444
const faasType = inputs.type || 'event'
4545

4646
const { scfInputs, useDefault } = await formatInputs(this, credentials, appId, inputs)
47-
4847
const scf = new Scf(credentials, region)
4948
const scfOutput = await scf.deploy(scfInputs)
5049

src/utils.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,17 @@ const formatInputs = async (instance, credentials, appId, inputs) => {
187187
if (inputs.provisionedNum) {
188188
inputs.publish = false
189189
}
190+
// 如果是ws函数,protocolType置为WEBSOCKET
191+
if (inputs.protocolType === 'WS' || inputs.type === 'web') {
192+
inputs.events &&
193+
inputs.events.forEach((v) => {
194+
v.apigw.parameters.endpoints &&
195+
v.apigw.parameters.endpoints.forEach((item) => {
196+
item.protocolType = 'WEBSOCKET'
197+
})
198+
})
199+
}
200+
190201
// 基于镜像部署
191202
let imageCode
192203
if (inputs.image) {

0 commit comments

Comments
 (0)