*If we have no active gateways, try to refresh the list first
This commit is contained in:
parent
b70c77eeda
commit
564306bed2
|
@ -1,4 +1,4 @@
|
||||||
import { addHandler, handleMessage , log} from "libkmodule";
|
import { addHandler, handleMessage, log } from "libkmodule";
|
||||||
import type { ActiveQuery } from "libkmodule";
|
import type { ActiveQuery } from "libkmodule";
|
||||||
import PQueue from "p-queue";
|
import PQueue from "p-queue";
|
||||||
import { ipfsPath, ipnsPath } from "is-ipfs";
|
import { ipfsPath, ipnsPath } from "is-ipfs";
|
||||||
|
@ -137,6 +137,9 @@ async function fetchFromRelays(
|
||||||
stream = undefined
|
stream = undefined
|
||||||
) {
|
) {
|
||||||
let error = new Error("NOT_FOUND");
|
let error = new Error("NOT_FOUND");
|
||||||
|
if (0 == activeRelays.length) {
|
||||||
|
await refreshGatewayList();
|
||||||
|
}
|
||||||
for (const relay of activeRelays) {
|
for (const relay of activeRelays) {
|
||||||
let resp;
|
let resp;
|
||||||
try {
|
try {
|
||||||
|
@ -216,7 +219,7 @@ async function rpcCall(
|
||||||
stream(response?.data.data);
|
stream(response?.data.data);
|
||||||
if (response?.data.done) {
|
if (response?.data.done) {
|
||||||
socket.end();
|
socket.end();
|
||||||
resolve(true);
|
resolve(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -229,7 +232,7 @@ async function rpcCall(
|
||||||
force: true,
|
force: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
/* timer = setTimeout(() => {
|
/* timer = setTimeout(() => {
|
||||||
socket.end();
|
socket.end();
|
||||||
reject("timeout");
|
reject("timeout");
|
||||||
}, 10 * 1000) as NodeJS.Timeout;*/
|
}, 10 * 1000) as NodeJS.Timeout;*/
|
||||||
|
|
Loading…
Reference in New Issue