-
Notifications
You must be signed in to change notification settings - Fork 279
/
Copy pathretry_client.rs
47 lines (41 loc) · 1.41 KB
/
retry_client.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//// To the extent possible under law, the author(s) have dedicated all
//// copyright and related and neighboring rights to this software to
//// the public domain worldwide. This software is distributed without
//// any warranty.
////
//// You should have received a copy of the CC0 Public Domain Dedication
//// along with this software.
//// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
////
//extern crate bitcoincore_rpc;
//extern crate jsonrpc;
//extern crate serde;
//extern crate serde_json;
//use bitcoincore_rpc::{Client, Error, Result, RpcApi};
//pub struct RetryClient {
// client: Client,
//}
//const INTERVAL: u64 = 1000;
//const RETRY_ATTEMPTS: u8 = 10;
//impl RpcApi for RetryClient {
// fn call<T: for<'a> serde::de::Deserialize<'a>>(
// &self,
// cmd: &str,
// args: &[serde_json::Value],
// ) -> Result<T> {
// for _ in 0..RETRY_ATTEMPTS {
// match self.client.call(cmd, args) {
// Ok(ret) => return Ok(ret),
// Err(Error::JsonRpc(jsonrpc::error::Error::Rpc(ref rpcerr)))
// if rpcerr.code == -28 =>
// {
// ::std::thread::sleep(::std::time::Duration::from_millis(INTERVAL));
// continue;
// }
// Err(e) => return Err(e),
// }
// }
// self.client.call(cmd, args)
// }
//}
fn main() {}