Skip to content

Commit

Permalink
Standardize an error
Browse files Browse the repository at this point in the history
  • Loading branch information
marcua committed Aug 11, 2024
1 parent e732ef7 commit feec134
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/snapshots/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@ pub async fn schedule_periodic_snapshots(
if let Some(ref snapshot_config) = config.snapshots {
if let Some(ref automation_config) = snapshot_config.automation {
let scheduler = JobScheduler::new().await?;
// TODO(marcua): Consider something better than
// try_into/unwrap. The problem is that `parse_duration`
// produces an i64 and `from_nanos` expects u64.
let duration = Duration::from_nanos(
parse_duration(&automation_config.interval)?
.try_into()
.unwrap(),
.map_err(|err| AybError::SnapshotError {
message: format!("Unable to turn snapshot interval into a duration: {:?}", err)
})?
);
scheduler
.add(Job::new_repeated_async(duration, move |_, _| {
Expand Down

0 comments on commit feec134

Please sign in to comment.