change structure of promises in isAllowed
This commit is contained in:
parent
7dd96fc8f9
commit
89dcf00958
|
@ -73,7 +73,8 @@ async function checkPCAndLists(f, ip, ipKey) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(`Error checkAllowed for ${ip}: ${err.message}`);
|
logger.error(`Error checkAllowed for ${ip}: ${err.message}`);
|
||||||
}
|
}
|
||||||
return [allowed, status, pcheck];
|
const caPromise = cacheAllowed(ipKey, status);
|
||||||
|
return [allowed, status, pcheck, caPromise];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -86,7 +87,7 @@ async function withoutCache(f, ip) {
|
||||||
const ipKey = getIPv6Subnet(ip);
|
const ipKey = getIPv6Subnet(ip);
|
||||||
|
|
||||||
const [
|
const [
|
||||||
[allowed, status, pcheck],
|
[allowed, status, pcheck, caPromise],
|
||||||
whoisRet,
|
whoisRet,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
checkPCAndLists(f, ip, ipKey),
|
checkPCAndLists(f, ip, ipKey),
|
||||||
|
@ -94,7 +95,7 @@ async function withoutCache(f, ip) {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
cacheAllowed(ipKey, status),
|
caPromise,
|
||||||
saveIPInfo(ipKey, whoisRet, status, pcheck),
|
saveIPInfo(ipKey, whoisRet, status, pcheck),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user