Skip to content

Commit

Permalink
fix(app-service): fix func_id type to ObjectId
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Nov 5, 2021
1 parent ec1864f commit 8edecc8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ services:
SYS_SERVER_SECRET_SALT: Rewrite_Your_Own_Secret_Salt_abcdefg1234567
SHARED_NETWORK: laf_shared_network
LOG_LEVEL: debug
APP_SERVICE_IMAGE: lafyun/app-service:0.6.8
APP_SERVICE_IMAGE: lafyun/app-service:latest
ACCOUNT_DEFAULT_APP_QUOTA: 5
APP_SERVICE_DEPLOY_HOST: local-dev.host:8080 # `*.local-dev.host` always resolved to 127.0.0.1, used to local development
APP_SERVICE_DEPLOY_URL_SCHEMA: 'http'
Expand Down
9 changes: 6 additions & 3 deletions packages/app-service/src/lib/scheduler/scheduler.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/*
* @Author: Maslow<wangfugen@126.com>
* @Date: 2021-07-30 10:30:29
* @LastEditTime: 2021-09-09 22:59:48
* @LastEditTime: 2021-11-05 14:46:49
* @Description:
*/

import { getFunctionById } from "../../api/function"
import { addFunctionLog } from "../../api/function-log"
import { addFunctionLog, CloudFunctionLogStruct } from "../../api/function-log"
import { CloudFunction, TriggerScheduler } from "cloud-function-engine"
import { createLogger } from "../logger"
import assert = require("assert")
import { ObjectId } from "bson"


const logger = createLogger('scheduler')
Expand Down Expand Up @@ -41,7 +42,9 @@ export class FrameworkScheduler extends TriggerScheduler {
* @override
* @param data
*/
async addFunctionLog(data: any) {
async addFunctionLog(data: CloudFunctionLogStruct) {
// func_id from TriggerScheduler is string type, convert it to ObjectId
data.func_id = new ObjectId(data.func_id)
await addFunctionLog(data)
}

Expand Down
4 changes: 2 additions & 2 deletions packages/cloud-function/src/trigger-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class TriggerScheduler {
* @returns
*/
protected async getFunctionById(_func_id: string): Promise<CloudFunction> {
throw new Error('not implemented, you should drive TriggerScheduler class and override getFunctionById() method')
throw new Error('not implemented, you should derive TriggerScheduler class and override getFunctionById() method')
}

/**
Expand All @@ -105,7 +105,7 @@ export class TriggerScheduler {
await this.addFunctionLog({
requestId: `trigger_${trigger.id}`,
method: param.method,
func_id: func.id,
func_id: func_id,
func_name: func.name,
logs: result.logs,
time_usage: result.time_usage,
Expand Down

0 comments on commit 8edecc8

Please sign in to comment.