Commit 2675aeff authored by nanahira's avatar nanahira

add maintaince

parent 479d0773
Pipeline #16855 passed with stages
in 2 minutes and 16 seconds
......@@ -30,6 +30,7 @@ interface Config {
retryCount: number;
interval: number;
cocurrent: number;
maintainance?: string[];
}
interface DomainRecordObject {
......@@ -350,6 +351,9 @@ class Checker {
return ConnectResult.CDNBad;
}
}
maintainance: Set<string>;
constructor(private config: Config) {
this.queue = new PQueue({ concurrency: this.config.cocurrent || 10 });
this.client = new Aliyun(config.aliyun);
......@@ -367,6 +371,7 @@ class Checker {
this.checkMethods.set('icmp', (record: Source, address: string) => {
return this.checkIcmp(record, address);
});
this.maintainance = new Set(config.maintainance || []);
}
private message(msg: string) {
console.log(`${this.id} => ${msg}`);
......@@ -442,6 +447,15 @@ class Checker {
}
async checkSource(source: Source, address: string): Promise<ConnectResult> {
if (this.maintainance.has(address)) {
this.message(
`Skip ${this.getSourcePattern(
source,
address,
)} because it is in maintainance.`,
);
return ConnectResult.CDNBad;
}
const checkMethodFunction = this.checkMethods.get(source.protocol);
assert(
checkMethodFunction,
......
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