Files
massive-cloud/server/smoothHeatmapJobRunner.ts

27 lines
931 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 独立进程入口:平滑热力在子进程跑,避免阻塞主进程事件循环(HTTP / Vite)。
* 开发:node --import tsx server/smoothHeatmapJobRunner.ts <resultId> <taskId> <totalPoints>
* 生产:node dist/smoothHeatmapJobRunner.js ...
*/
import 'dotenv/config';
import { runSmoothHeatmapJob } from './smoothHeatmapJob.js';
const [, , a, b, c] = process.argv;
const resultId = Number(a);
const taskId = Number(b);
const totalPoints = Number(c);
if (!Number.isFinite(resultId) || !Number.isFinite(taskId) || resultId <= 0 || taskId <= 0) {
console.error('[SmoothHeatmapJobRunner] 用法: <resultId> <taskId> <totalPoints>');
process.exit(1);
}
const pts = Number.isFinite(totalPoints) && totalPoints > 0 ? totalPoints : 400_000;
runSmoothHeatmapJob(resultId, taskId, pts)
.then(() => process.exit(0))
.catch((e) => {
console.error('[SmoothHeatmapJobRunner]', e);
process.exit(1);
});