mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-20 15:30:39 +01:00
fix: wrap cached returns for dns lookups in nextTick
This commit is contained in:
@@ -58,12 +58,15 @@ function lookup(hostname, options, callback) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lookup needs to behave asynchronously — https://github.com/nodejs/node/issues/28664
|
||||||
|
process.nextTick(() => {
|
||||||
if (options.all === true) {
|
if (options.all === true) {
|
||||||
callback(null, lookup);
|
callback(null, lookup);
|
||||||
} else {
|
} else {
|
||||||
const { address, family } = lookup.shift();
|
const { address, family } = lookup.shift();
|
||||||
callback(null, address, family);
|
callback(null, address, family);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize fetch - somewhat hacky, but it's required for globalDispatcher to be available
|
// Initialize fetch - somewhat hacky, but it's required for globalDispatcher to be available
|
||||||
|
|||||||
Reference in New Issue
Block a user