make extension robust to dns failures (test0)

This commit is contained in:
ilyaigpetrov 2021-08-27 16:19:50 +00:00
parent 5b3e6f1f51
commit 86d07b79c3
2 changed files with 8 additions and 9 deletions

View File

@ -469,24 +469,24 @@
reject([err, ...warns]);
return;
}
resolve(err, res, ...warns);
resolve([err, res, ...warns]);
},
),
);
const ipsErrorPromise = !ifUnattended
const ipsPromise = !ifUnattended
? updateIpsAsync()
: tryPromiseSeveralTimesAsync(updateIpsAsync, [20, 40, 60]);
Promise.all([pacSetPromise, ipsErrorPromise]).then(
([[pacErr, pacRes, ...pacWarns], ipsErr]) => {
Promise.all([pacSetPromise, ipsPromise]).then(
([[pacErr, pacRes, ...pacWarns], [ipsErr, ipsRes, ...ipsWarns]]) => {
if (pacErr && ipsErr) {
if (pacErr) {
return cb(pacErr, pacRes);
}
const warns = pacWarns;
if (ipsErr) {
warns.push(ipsErr);
if (ipsErr || ipsWarns.length) {
warns.push(...[ipsErr], ...ipsWarns);
}
this.pushToStorageAsync(
(pushErr) => cb(pacErr || pushErr, null, ...warns),

View File

@ -115,7 +115,7 @@
const promises = types.map(
(type) => new Promise((resolve) =>
httpLib.get(
`https://dnsssssss.google.com/resolve?type=${type}&name=${host}&random_padding=${generateRandomHexString(30,500)}`,
`https://dns.google.com/resolve?type=${type}&name=${host}&random_padding=${generateRandomHexString(30,500)}`,
(err, res) => {
if (res) {
@ -282,7 +282,6 @@
' блокировок может не отображаться.'
);
}
console.log('IP ERRORS:', ipErrors); // TODO:
cb(null, null, ipErrors);
});
},