Compare commits

...

3 Commits

Author SHA1 Message Date
Derrick Hammer 58190128a0
*Use our fork of p-timeout for commonjs
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-12-15 07:03:14 -05:00
Derrick Hammer d28868508b
Revert "*Need to use dynamic import"
This reverts commit 6413d97c61.
2022-12-15 06:23:28 -05:00
Derrick Hammer 485fa98f0e
Revert "*Need to return dynamic function and execute it"
This reverts commit 55fa792bc9.
2022-12-15 06:23:28 -05:00
3 changed files with 6 additions and 23 deletions

View File

@ -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",

View File

@ -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);

View File

@ -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