fix(core): update
This commit is contained in:
parent
b6d8c36f3e
commit
f2ebaf74d9
14
ts/index.ts
14
ts/index.ts
@ -43,23 +43,25 @@ export class Smartdns {
|
|||||||
async checkUntilAvailable(
|
async checkUntilAvailable(
|
||||||
recordNameArg: string,
|
recordNameArg: string,
|
||||||
recordTypeArg: TDnsRecordType,
|
recordTypeArg: TDnsRecordType,
|
||||||
expectedValue: string
|
expectedValue: string,
|
||||||
|
cyclesArg: number = 50,
|
||||||
|
intervalArg: number = 500
|
||||||
) {
|
) {
|
||||||
let cycleArg = 0;
|
let runCycles = 0;
|
||||||
let doCheck = async () => {
|
let doCheck = async () => {
|
||||||
if (cycleArg < 30) {
|
if (runCycles < cyclesArg) {
|
||||||
cycleArg++;
|
runCycles++;
|
||||||
try {
|
try {
|
||||||
let myRecordArray = await this.getRecord(recordNameArg, recordTypeArg);
|
let myRecordArray = await this.getRecord(recordNameArg, recordTypeArg);
|
||||||
let myRecord = myRecordArray[0].value[0];
|
let myRecord = myRecordArray[0].value[0];
|
||||||
if (myRecord === expectedValue) {
|
if (myRecord === expectedValue) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
await plugins.smartdelay.delayFor(2000);
|
await plugins.smartdelay.delayFor(intervalArg);
|
||||||
return await doCheck();
|
return await doCheck();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
await plugins.smartdelay.delayFor(2000);
|
await plugins.smartdelay.delayFor(intervalArg);
|
||||||
return await doCheck();
|
return await doCheck();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user