mirror of
https://github.com/fluencelabs/aqua-ipfs
synced 2025-04-25 07:52:13 +00:00
index.ts: set_timeout to 10s
This commit is contained in:
parent
ac976f6967
commit
4093abcf31
@ -13,3 +13,7 @@ func get_from(node: PeerId, hash: string, from: Multiaddr) -> IpfsGetFromResult:
|
|||||||
on node:
|
on node:
|
||||||
result <- Ipfs.get_from(hash, from)
|
result <- Ipfs.get_from(hash, from)
|
||||||
<- result
|
<- result
|
||||||
|
|
||||||
|
func set_timeout(node: PeerId, timeout_sec: u64):
|
||||||
|
on node:
|
||||||
|
Ipfs.set_timeout(timeout_sec)
|
||||||
|
4691
aqua/package-lock.json
generated
4691
aqua/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -26,8 +26,9 @@
|
|||||||
"compile-aqua": "aqua-cli -i . -o ./typescript",
|
"compile-aqua": "aqua-cli -i . -o ./typescript",
|
||||||
"prebuild": "npm run compile-aqua",
|
"prebuild": "npm run compile-aqua",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"prestart": "npm run build",
|
"prestart:local": "npm run build",
|
||||||
"start:local": "node typescript/dist/index.js local",
|
"start:local": "node typescript/dist/index.js local",
|
||||||
|
"prestart:remote": "npm run build",
|
||||||
"start:remote": "node typescript/dist/index.js testnet",
|
"start:remote": "node typescript/dist/index.js testnet",
|
||||||
"start": "npm run start:remote"
|
"start": "npm run start:remote"
|
||||||
},
|
},
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { put, get_from } from './ipfs-api';
|
import { put, get_from, set_timeout } from './ipfs-api';
|
||||||
|
|
||||||
import {createClient, registerServiceFunction, setLogLevel, FluenceClient} from "@fluencelabs/fluence";
|
import {createClient, setLogLevel} from "@fluencelabs/fluence";
|
||||||
import {stage, krasnodar, Node, testNet} from "@fluencelabs/fluence-network-environment";
|
import {stage, krasnodar, Node, testNet} from "@fluencelabs/fluence-network-environment";
|
||||||
const { create, globSource, urlSource } = require('ipfs-http-client');
|
const { create, globSource, urlSource } = require('ipfs-http-client');
|
||||||
const all = require('it-all');
|
const all = require('it-all');
|
||||||
@ -61,6 +61,9 @@ async function main(environment: Node[]) {
|
|||||||
console.log("📗 downloaded file of length ", content.length);
|
console.log("📗 downloaded file of length ", content.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// default IPFS timeout is 1 sec, set to 10 secs to retrieve file from remote node
|
||||||
|
await set_timeout(fluence, environment[2].peerId, 10);
|
||||||
|
|
||||||
console.log("📘 file hash: ", file.cid);
|
console.log("📘 file hash: ", file.cid);
|
||||||
let getResult = await get_from(fluence, environment[2].peerId, file.cid.toString(), ipfsMultiaddr, { ttl: 10000 });
|
let getResult = await get_from(fluence, environment[2].peerId, file.cid.toString(), ipfsMultiaddr, { ttl: 10000 });
|
||||||
console.log("📘 Ipfs.get", getResult);
|
console.log("📘 Ipfs.get", getResult);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user