Skip to content

Commit

Permalink
Add units to the name of MakerConfig files
Browse files Browse the repository at this point in the history
e.g. rpc_ping_interval ---> rpc_ping_interval_secs

its in seconds
  • Loading branch information
chris-belcher committed Feb 15, 2022
1 parent 876e986 commit c34f75c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,9 @@ pub fn run_maker(
let wallet_ptr = Arc::new(RwLock::new(wallet));
let config = maker_protocol::MakerConfig {
port,
rpc_ping_interval: 60,
watchtower_ping_interval: 300,
directory_servers_refresh_interval: 60 * 60 * 12, //12 hours
rpc_ping_interval_secs: 60,
watchtower_ping_interval_secs: 300,
directory_servers_refresh_interval_secs: 60 * 60 * 12, //12 hours
maker_behavior,
kill_flag: if kill_flag.is_none() {
Arc::new(RwLock::new(false))
Expand Down
19 changes: 12 additions & 7 deletions src/maker_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ pub enum MakerBehavior {
#[derive(Debug, Clone)]
pub struct MakerConfig {
pub port: u16,
pub rpc_ping_interval: u64,
pub watchtower_ping_interval: u64,
pub directory_servers_refresh_interval: u64,
pub rpc_ping_interval_secs: u64,
pub watchtower_ping_interval_secs: u64,
pub directory_servers_refresh_interval_secs: u64,
pub maker_behavior: MakerBehavior,
pub kill_flag: Arc<RwLock<bool>>,
pub idle_connection_timeout: u64,
Expand Down Expand Up @@ -145,9 +145,14 @@ async fn run(
}
break Err(client_err.unwrap());
},
_ = sleep(Duration::from_secs(config.rpc_ping_interval)) => {
let rpc_ping_success = wallet.write().unwrap().refresh_offer_maxsize_cache(Arc::clone(&rpc)).is_ok();
let watchtowers_ping_interval = Duration::from_secs(config.watchtower_ping_interval);
_ = sleep(Duration::from_secs(config.rpc_ping_interval_secs)) => {
let rpc_ping_success = wallet
.write()
.unwrap()
.refresh_offer_maxsize_cache(Arc::clone(&rpc))
.is_ok();
let watchtowers_ping_interval
= Duration::from_secs(config.watchtower_ping_interval_secs);
let (watchtowers_ping_success, debug_msg) = if Instant::now()
.saturating_duration_since(last_watchtowers_ping)
> watchtowers_ping_interval {
Expand All @@ -164,7 +169,7 @@ async fn run(
}

let directory_servers_refresh_interval = Duration::from_secs(
config.directory_servers_refresh_interval
config.directory_servers_refresh_interval_secs
);
if NETWORK != Network::Regtest
&& Instant::now().saturating_duration_since(last_directory_servers_refresh)
Expand Down

0 comments on commit c34f75c

Please sign in to comment.