优化启动脚本

This commit is contained in:
CounterFire2023 2024-01-15 13:57:01 +08:00
parent acfee0ee69
commit 65abad1eb3
2 changed files with 43 additions and 3 deletions

View File

@ -168,7 +168,11 @@ export class EventBatchSvr {
const record = await GeneralEvent.saveEvent(event)
blockNumber = Math.max(parseInt(event.blockNumber, 16), cfg.fromBlock)
if (cfg.eventProcesser && eventProcessers[cfg.eventProcesser]) {
await eventProcessers[cfg.eventProcesser].parseEvent(record)
try {
await eventProcessers[cfg.eventProcesser].parseEvent(record)
} catch (err) {
logger.error('process event error: ', err.message || err)
}
}
}
return blockNumber

View File

@ -2,8 +2,7 @@
"apps": [
{
"name": "chain-client",
"script": "npm",
"args": "run prod:api",
"script": "./dist/api.js",
"cwd": "/root/code/web_chain_client",
"max_memory_restart": "1024M",
"log_date_format": "YYYY-MM-DD HH:mm Z",
@ -12,7 +11,44 @@
"instances": 1,
"exec_mode": "fork",
"env": {
"NODE_ENV": "production",
"NODE_PATH": "./dist"
},
"env_production": {
"NODE_ENV": "production"
}
},
{
"name": "chain-scriptions",
"script": "./dist/scriptions.js",
"cwd": "/root/code/web_chain_client",
"max_memory_restart": "1024M",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"watch": false,
"ignore_watch": ["node_modules", "logs", "fixtures", "tasks"],
"instances": 1,
"exec_mode": "fork",
"env": {
"NODE_ENV": "production",
"NODE_PATH": "./dist"
},
"env_production": {
"NODE_ENV": "production"
}
},
{
"name": "chain-events",
"script": "./dist/events.js",
"cwd": "/root/code/web_chain_client",
"max_memory_restart": "1024M",
"log_date_format": "YYYY-MM-DD HH:mm Z",
"watch": false,
"ignore_watch": ["node_modules", "logs", "fixtures", "tasks"],
"instances": 1,
"exec_mode": "fork",
"env": {
"NODE_ENV": "production",
"NODE_PATH": "./dist"
},
"env_production": {
"NODE_ENV": "production"