Compare commits
3 Commits
bd1226ad18
...
58190128a0
Author | SHA1 | Date |
---|---|---|
|
58190128a0 | |
|
d28868508b | |
|
485fa98f0e |
|
@ -52,7 +52,7 @@
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"node-cron": "^3.0.1",
|
"node-cron": "^3.0.1",
|
||||||
"node-fetch": "2",
|
"node-fetch": "2",
|
||||||
"p-timeout": "^6.0.0",
|
"p-timeout": "https://git.lumeweb.com/LumeWeb/p-timeout.git",
|
||||||
"promise-retry": "^2.0.1",
|
"promise-retry": "^2.0.1",
|
||||||
"protomux": "^3.4.0",
|
"protomux": "^3.4.0",
|
||||||
"protomux-rpc": "^1.3.0",
|
"protomux-rpc": "^1.3.0",
|
||||||
|
|
|
@ -11,30 +11,13 @@ import {
|
||||||
import { getRpcByPeer } from "../rpc";
|
import { getRpcByPeer } from "../rpc";
|
||||||
import { get as getSwarm, LUMEWEB_TOPIC_HASH } from "../swarm";
|
import { get as getSwarm, LUMEWEB_TOPIC_HASH } from "../swarm";
|
||||||
import b4a from "b4a";
|
import b4a from "b4a";
|
||||||
|
import pTimeout, { ClearablePromise } from "p-timeout";
|
||||||
import type { ClearablePromise } from "p-timeout";
|
|
||||||
|
|
||||||
async function dImport(pkg: string): Promise<any> {
|
|
||||||
return new Function(`return import("${pkg}")`)();
|
|
||||||
}
|
|
||||||
|
|
||||||
let pTimeout: typeof import("p-timeout").default;
|
|
||||||
const pTimeoutImport = dImport(
|
|
||||||
"p-timeout"
|
|
||||||
) as unknown as typeof import("p-timeout");
|
|
||||||
|
|
||||||
async function importSetup() {
|
|
||||||
if (!pTimeout) {
|
|
||||||
pTimeout = (await pTimeoutImport).default;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function broadcastRequest(
|
async function broadcastRequest(
|
||||||
request: RPCRequest,
|
request: RPCRequest,
|
||||||
relays: string[],
|
relays: string[],
|
||||||
timeout = 5000
|
timeout = 5000
|
||||||
): Promise<Map<string, Promise<any>>> {
|
): Promise<Map<string, Promise<any>>> {
|
||||||
await importSetup();
|
|
||||||
const makeRequest = async (relay: string) => {
|
const makeRequest = async (relay: string) => {
|
||||||
const rpc = await getRpcByPeer(relay);
|
const rpc = await getRpcByPeer(relay);
|
||||||
return rpc.request(`${request.module}.${request.method}`, request.data);
|
return rpc.request(`${request.module}.${request.method}`, request.data);
|
||||||
|
|
|
@ -690,7 +690,7 @@ __metadata:
|
||||||
node-cron: ^3.0.1
|
node-cron: ^3.0.1
|
||||||
node-fetch: 2
|
node-fetch: 2
|
||||||
node-gyp: ^9.1.0
|
node-gyp: ^9.1.0
|
||||||
p-timeout: ^6.0.0
|
p-timeout: "https://git.lumeweb.com/LumeWeb/p-timeout.git"
|
||||||
pkg: ^5.8.0
|
pkg: ^5.8.0
|
||||||
prebuildify: ^5.0.1
|
prebuildify: ^5.0.1
|
||||||
prettier: ^2.7.1
|
prettier: ^2.7.1
|
||||||
|
@ -3719,10 +3719,10 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"p-timeout@npm:^6.0.0":
|
"p-timeout@https://git.lumeweb.com/LumeWeb/p-timeout.git":
|
||||||
version: 6.0.0
|
version: 6.0.0
|
||||||
resolution: "p-timeout@npm:6.0.0"
|
resolution: "p-timeout@https://git.lumeweb.com/LumeWeb/p-timeout.git#commit=4d4bee14a2cddb72111a95544e91bc957a1d3611"
|
||||||
checksum: c61e72678f3d2a9265d44c871e282e199c68b9b739005884d83dc8451ec8fe6581040fb10d9a48b2136e1b0b75042c6b528130a40bbad08eea6a53838a190b45
|
checksum: 34a0dc6acdb3d51f3898b0122d1c1ace2a79a146b7fb1ebeb9ae2159e28c0f391807f29ae58f313ec3b6ce0e1e478215b9258c0517eac6b0845b20f48f04c539
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue