From 89d5c2ec9b83f619d72b31cc003a41bc691a1f19 Mon Sep 17 00:00:00 2001 From: Harry Chen Date: Fri, 7 May 2021 11:12:49 +0800 Subject: [PATCH] fix: disable wait event loop in tencent serverless (#1029) --- packages-serverless/serverless-scf-starter/src/runtime.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages-serverless/serverless-scf-starter/src/runtime.ts b/packages-serverless/serverless-scf-starter/src/runtime.ts index ee4005c9de81..d58eca4e1b43 100644 --- a/packages-serverless/serverless-scf-starter/src/runtime.ts +++ b/packages-serverless/serverless-scf-starter/src/runtime.ts @@ -97,6 +97,9 @@ export class SCFRuntime extends ServerlessLightRuntime { } } + // 不再等待事件循环 + // https://cloud.tencent.com/document/product/583/11060 + context.callbackWaitsForEmptyEventLoop = false; return { isBase64Encoded: encoded, statusCode: ctx.status, @@ -106,6 +109,7 @@ export class SCFRuntime extends ServerlessLightRuntime { }) .catch(err => { ctx.logger.error(err); + context.callbackWaitsForEmptyEventLoop = false; return { isBase64Encoded: false, statusCode: 500,