-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
代码大概是这样的
**const processPool = new ProcessPool({
maxParallelProcess: 50, // 支持最大进程并行数
timeToClose: 10 * 1000, // 单个任务被执行最大时长
dependency: const path = require('path'); var lib=require("./lib");var execSync = require('child_process').execSync;var config = require('./config');, // 任务脚本依赖
workDir: __dirname, // 当前目录
taskName: 'doTwitter', // 任务脚本名称
script: async function task(workParam) {
val = workParam;
cmd = `twint -u '${val}' --since '${today} 00:00:00' ${proxy} -o ./data/${val}_${today}.json --json`;
// console.log(cmd);
execSync(cmd,{timeout:8000});
}, // 任务脚本内容
taskParams // 需要执行的任务参数列表,二维数组
});
// 创建进程池实例
// 利用进程池进行处理大规模任务
processPool.run();**
跑完了 脚本没退出
Metadata
Metadata
Assignees
Labels
No labels