refactor: add unit to ping_interval config

This commit is contained in:
Greg Heartsfield 2022-11-05 07:42:08 -05:00
parent 50577b2dfa
commit 11e43eccf9
2 changed files with 3 additions and 3 deletions

View File

@ -29,7 +29,7 @@ pub struct Network {
pub port: u16, pub port: u16,
pub address: String, pub address: String,
pub remote_ip_header: Option<String>, // retrieve client IP from this HTTP header if present pub remote_ip_header: Option<String>, // retrieve client IP from this HTTP header if present
pub ping_interval: u32, pub ping_interval_seconds: u32,
} }
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
@ -208,7 +208,7 @@ impl Default for Settings {
}, },
network: Network { network: Network {
port: 8080, port: 8080,
ping_interval: 300, ping_interval_seconds: 300,
address: "0.0.0.0".to_owned(), address: "0.0.0.0".to_owned(),
remote_ip_header: None, remote_ip_header: None,
}, },

View File

@ -427,7 +427,7 @@ async fn nostr_server(
let mut last_message_time = Instant::now(); let mut last_message_time = Instant::now();
// ping interval (every 5 minutes) // ping interval (every 5 minutes)
let default_ping_dur = Duration::from_secs(settings.network.ping_interval.into()); let default_ping_dur = Duration::from_secs(settings.network.ping_interval_seconds.into());
// disconnect after 20 minutes without a ping response or event. // disconnect after 20 minutes without a ping response or event.
let max_quiet_time = Duration::from_secs(60 * 20); let max_quiet_time = Duration::from_secs(60 * 20);