Commit 9d83ceb4 authored by wang's avatar wang

收集环境

parent 8d7b6a16
# PX3 bypass
主要看src 目录下的代码
run.js 对应 nk
f91.js 对应 f9
一般更新的话 只要改掉 这两个值即可
```js
class PxBypass {
tag = "v9.1.1"
ft = "339"
}
```
### 运行方式
需要并发启动 看 poolStart.js
```js
// 配置并发数
const pool = new ThreadPool(5);
```
ThreadPool.js
```js
import {Worker} from 'worker_threads';
//主线程
export class ThreadPool {
size = 5;
queue = [];
workerGroup = [];
free = 0;
maxFree = 2;
monitor = null;
constructor(size) {
this.size = size;
}
//初始化子线程
init() {
for (let i = 0; i < this.size; i++) {
this.workerGroup.push({
id: i,
status: false,
// 配置要读取哪个代码进行并发
worker: new Worker('./f91.js')
});
this.workerGroup[i].worker.on("message", (message) => {
if (message === 'end') {
this.workerGroup[i].status = false;
this.check();
}
});
}
this.monitor = setInterval(() => {
if (this.isFree()) {
this.free++;
console.log(`空闲次数: ${this.free},如果超过${this.maxFree}次,线程池将关闭,后续提交任务将自动开启`)
} else {
this.free = 0;
}
this.check();
if (this.free > this.maxFree) {
this.shutdown();
clearInterval(this.monitor);
this.monitor = null;
this.workerGroup = [];
this.free = 0;
}
}, 10000)
}
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment