Commit 7564f0a5 authored by nanahira's avatar nanahira

configurable queue

parent 894f815f
Pipeline #16317 passed with stages
in 1 minute and 26 seconds
...@@ -28,6 +28,7 @@ interface Config { ...@@ -28,6 +28,7 @@ interface Config {
timeout: number; timeout: number;
retryCount: number; retryCount: number;
interval: number; interval: number;
cocurrent: number;
} }
interface DomainRecordObject { interface DomainRecordObject {
...@@ -203,7 +204,7 @@ class Checker { ...@@ -203,7 +204,7 @@ class Checker {
} }
} }
private queue = new PQueue({ concurrency: 100 }); private queue: PQueue;
private async tryConnectHttp( private async tryConnectHttp(
protocol: string, protocol: string,
...@@ -344,6 +345,7 @@ class Checker { ...@@ -344,6 +345,7 @@ class Checker {
} }
} }
constructor(private config: Config) { constructor(private config: Config) {
this.queue = new PQueue({ concurrency: this.config.cocurrent || 10 });
this.client = new Aliyun(config.aliyun); this.client = new Aliyun(config.aliyun);
this.cdnRecordsRegex = config.cdnRecords.map((m) => new RegExp(m.match)); this.cdnRecordsRegex = config.cdnRecords.map((m) => new RegExp(m.match));
this.id = ++Checker.order; this.id = ++Checker.order;
......
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