Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime): fix func logging order #1072

Merged
merged 1 commit into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions runtimes/nodejs/src/support/function-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@ 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<IFunctionLog>(FUNCTION_LOG_COLLECTION)
const doc = {
request_id: ctx.requestId,
func: ctx.__function_name,
data: message,
created_at: new Date(),
}

await collection.insertOne(doc)
db.collection<IFunctionLog>(FUNCTION_LOG_COLLECTION).insertOne(doc)
}
2 changes: 1 addition & 1 deletion server/src/instance/instance-task.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>('Application').updateOne(
{ appid: app.appid, phase: ApplicationPhase.Starting },
{
Expand Down