perf: load page modules on demand and avoid repeated startup ACL writes

This commit is contained in:
abaishu0730 committed 2026-10-28 15:20:28 +08:00
1 parent 73773f9526
commit 7ead1e7cb7
19 files changed
+330 -24

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
'use strict';
const fs=require('node:fs'),http=require('node:http');
const {respondToPing}=require('../../src/platform/service/ping.cjs');
const file=process.env.ORDER_FIXTURE_COUNT;
fs.writeFileSync(file,String((fs.existsSync(file)?Number(fs.readFileSync(file,'utf8')):0)+1));
if(!fs.existsSync(file+'.ready')){
process.send({type:'order:startup-failed',diagnostic:{type:'Error',stage:'key_directory',code:'STORAGE_UNAVAILABLE',causeCode:'ETIMEDOUT',durationMs:30000,message:'SECRET_FIXTURE_NOT_FOR_STATE'}});
process.exitCode=1;
}else{
const server=http.createServer((request,response)=>respondToPing(request,response,{token:process.env.ORDER_SUPERVISOR_TOKEN,instanceId:process.env.ORDER_SUPERVISOR_INSTANCE,startedAt:new Date().toISOString()}));
server.listen(Number(process.env.ORDER_FIXTURE_PORT),'127.0.0.1');
process.on('message',message=>{if(message==='order:shutdown'){server.closeAllConnections();server.close(()=>process.exit(0));}});
}