mpc-cli
Version:
码农村nodejs版本myprocesscontroller框架脚手架搭建器
51 lines • 1.58 kB
JavaScript
//console.log = function() {};
import V from 'gcl';
import pro from 'myprocesscontroller';
import {
ASCDealer
} from './ASCDealer';
pro.start(async function() {
const conf = V.AppSettings(this.Config, "dy");
if (!conf) throw new Error('配置获取失败!');
let count = {};
const that = this;
return new pro.CACProcess(new class extends pro.ABulkWorker {
constructor() {
super('wk', threadcount, 1000, 6000000, max);
}
async getData(data) {
console.log('获取数据');
return null;
}
async bulkcustom(ret2, data) {
if (!data.array) data.array = 1;
else data.array++;
if (!data.client) {
data.Log = that.Log;
data.Ni = that.Ni;
data.Config = that.Config;
}
const ret = ret2;
//todo here and ret2 is Array
//attach const res = await that.Ni.excute('command',params);
return false;
}
async rollback(v, data) {
console.log('rollback 抛弃数据', v);
return false;
}
async dispose(data) {
try {
await super.dispose(data);
} catch (e) {
console.log('dispose', e.message);
} finally {
//todo 关闭特有资源
delete data.Log;
delete data.Ni;
delete data.Config;
}
return false;
}
}, this.Log, threadcount, 10000);
});