From 9011bb1b62781e1c21a50a166572f3ab5f4eb3ed Mon Sep 17 00:00:00 2001 From: maslow Date: Mon, 24 Apr 2023 18:22:34 +0800 Subject: [PATCH] fix(runtime): fix func logging order --- runtimes/nodejs/src/support/function-log.ts | 5 ++--- server/src/instance/instance-task.service.ts | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/runtimes/nodejs/src/support/function-log.ts b/runtimes/nodejs/src/support/function-log.ts index 1ae88c96d4..a89df2947c 100644 --- a/runtimes/nodejs/src/support/function-log.ts +++ b/runtimes/nodejs/src/support/function-log.ts @@ -9,11 +9,10 @@ export interface IFunctionLog { created_at: Date } -FunctionConsole.write = async (message: string, ctx: FunctionContext) => { +FunctionConsole.write = (message: string, ctx: FunctionContext) => { const db = DatabaseAgent.db if (!db) return - const collection = db.collection(FUNCTION_LOG_COLLECTION) const doc = { request_id: ctx.requestId, func: ctx.__function_name, @@ -21,5 +20,5 @@ FunctionConsole.write = async (message: string, ctx: FunctionContext) => { created_at: new Date(), } - await collection.insertOne(doc) + db.collection(FUNCTION_LOG_COLLECTION).insertOne(doc) } diff --git a/server/src/instance/instance-task.service.ts b/server/src/instance/instance-task.service.ts index 0ec5609267..7320fdc9e2 100644 --- a/server/src/instance/instance-task.service.ts +++ b/server/src/instance/instance-task.service.ts @@ -109,7 +109,7 @@ export class InstanceTaskService { // if waiting time is more than 5 minutes, stop the application const waitingTime = Date.now() - app.updatedAt.getTime() - if (waitingTime > 1000 * 60 * 5) { + if (waitingTime > 1000 * 60 * 3) { await db.collection('Application').updateOne( { appid: app.appid, phase: ApplicationPhase.Starting }, {