File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 11// Copyright 2023-, Edge & Node, GraphOps, and Semiotic Labs.
22// SPDX-License-Identifier: Apache-2.0
33
4- use std:: sync:: Arc ;
4+ use std:: { sync:: Arc , time :: Duration } ;
55
66use async_trait:: async_trait;
77use derivative:: Derivative ;
88use futures:: TryStreamExt ;
9- use ipfs_api_backend_hyper:: { IpfsApi , TryFromUri } ;
9+ use ipfs_api_backend_hyper:: { BackendWithGlobalOptions , GlobalOptions , IpfsApi , TryFromUri } ;
1010use serde:: Deserialize ;
1111
1212use crate :: DipsError ;
@@ -27,12 +27,16 @@ impl<T: IpfsFetcher> IpfsFetcher for Arc<T> {
2727#[ derivative( Debug ) ]
2828pub struct IpfsClient {
2929 #[ derivative( Debug = "ignore" ) ]
30- client : ipfs_api_backend_hyper:: IpfsClient ,
30+ client : ipfs_api_backend_hyper:: BackendWithGlobalOptions < IpfsClient > ,
3131}
3232
3333impl IpfsClient {
3434 pub fn new ( url : & str ) -> anyhow:: Result < Self > {
35- let client = ipfs_api_backend_hyper:: IpfsClient :: from_str ( url) ?;
35+ let opts = GlobalOptions {
36+ timeout : Some ( Duration :: from_secs ( 30 ) ) ,
37+ } ;
38+ let backend = ipfs_api_backend_hyper:: IpfsClient :: from_str ( url) ?;
39+ let client = BackendWithGlobalOptions :: new ( backend, opts) ;
3640 Ok ( Self { client } )
3741 }
3842}
You can’t perform that action at this time.
0 commit comments