Skip to content

Commit d32570a

Browse files
committed
use appropriate type when reading from the storage
1 parent f68b92d commit d32570a

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

jormungandr/src/blockchain_stuck_notifier.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ use tokio::timer::Interval;
1010
pub fn check_last_block_time(
1111
service_info: TokioServiceInfo,
1212
blockchain_tip: blockchain::Tip,
13-
check_interval: u64,
13+
check_interval: Duration,
1414
) -> impl Future<Item = (), Error = ()> {
1515
let logger = service_info.logger().clone();
1616
let err_logger = logger.clone();
1717

1818
// those are different values, because check_interval can be big
1919
// (30 minutes) and the notification may remain unseen
20-
let check_period = Duration::from_secs(check_interval);
20+
let check_period = check_interval;
2121
let notification_period = Duration::from_secs(60);
2222

2323
Interval::new_interval(notification_period)

jormungandr/src/settings/start/config.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ pub struct Config {
3232
pub explorer: Option<Explorer>,
3333

3434
/// the time interval with no blockchain updates after which alerts are thrown
35-
pub no_blockchain_updates_warning_interval: Option<u64>,
35+
#[serde(default)]
36+
pub no_blockchain_updates_warning_interval: Option<Duration>,
3637
}
3738

3839
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]

jormungandr/src/settings/start/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct Settings {
3535
pub mempool: Mempool,
3636
pub leadership: Leadership,
3737
pub explorer: bool,
38-
pub no_blockchain_updates_warning_interval: u64,
38+
pub no_blockchain_updates_warning_interval: std::time::Duration,
3939
}
4040

4141
pub struct RawSettings {
@@ -177,8 +177,11 @@ impl RawSettings {
177177
explorer,
178178
no_blockchain_updates_warning_interval: config
179179
.as_ref()
180-
.and_then(|config| config.no_blockchain_updates_warning_interval)
181-
.unwrap_or(DEFAULT_NO_BLOCKCHAIN_UPDATES_WARNING_INTERVAL),
180+
.and_then(|config| config.no_blockchain_updates_warning_interval.clone())
181+
.map(|d| d.into())
182+
.unwrap_or(std::time::Duration::from_secs(
183+
DEFAULT_NO_BLOCKCHAIN_UPDATES_WARNING_INTERVAL,
184+
)),
182185
})
183186
}
184187
}

0 commit comments

Comments
 (0)