pull/1091/head
Vincent 5 years ago
parent cd5a2f75de
commit 345c7b12d9

@ -783,9 +783,12 @@ class LokiSnodeAPI {
const timeoutResponse = { timedOut: true }; const timeoutResponse = { timedOut: true };
const maxTimeoutVal = 2 ** 31 - 1; const maxTimeoutVal = 2 ** 31 - 1;
const timeoutPromise = (cb, interval) => () => const timeoutPromise = (cb, interval) => () =>
new Promise(resolve => setTimeout(() => cb(resolve), interval || maxTimeoutVal)); new Promise(resolve =>
setTimeout(() => cb(resolve), interval || maxTimeoutVal)
);
const onTimeout = timeoutPromise( const onTimeout = timeoutPromise(
resolve => resolve(timeoutResponse), timeout resolve => resolve(timeoutResponse),
timeout
); );
// Get nodes capable of doing LNS // Get nodes capable of doing LNS
@ -857,7 +860,7 @@ class LokiSnodeAPI {
const nodes = lnsNodes.splice(0, numRequests); const nodes = lnsNodes.splice(0, numRequests);
// Start fetching from nodes // Start fetching from nodes
Promise.resolve(nodes.map(async node => fetchFromNode(node))); nodes.map(async node => fetchFromNode(node));
// Timeouts (optional parameter) // Timeouts (optional parameter)
// Wait for cipher to be found; race against timeout // Wait for cipher to be found; race against timeout

Loading…
Cancel
Save