File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 1- use crate :: { Error , StepResult } ;
1+ use crate :: { util :: std_duration_to_chrono , Error , StepResult } ;
22use async_trait:: async_trait;
33use chrono:: { DateTime , Utc } ;
44use serde:: { de:: DeserializeOwned , Serialize } ;
@@ -42,8 +42,7 @@ pub trait Scheduler: fmt::Debug + DeserializeOwned + Serialize + Sized + Sync {
4242
4343 /// Schedules a task to be run after a specified delay
4444 async fn delay < ' e > ( & self , db : impl PgExecutor < ' e > , delay : Duration ) -> crate :: Result < Uuid > {
45- let delay =
46- chrono:: Duration :: from_std ( delay) . unwrap_or_else ( |_| chrono:: Duration :: max_value ( ) ) ;
45+ let delay = std_duration_to_chrono ( delay) ;
4746 self . schedule ( db, Utc :: now ( ) + delay) . await
4847 }
4948
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ pub fn chrono_duration_to_std(chrono_duration: chrono::Duration) -> std::time::D
88
99/// Converts a std duration to chrono
1010pub fn std_duration_to_chrono ( std_duration : std:: time:: Duration ) -> chrono:: Duration {
11- chrono:: Duration :: from_std ( std_duration) . unwrap_or_else ( |_| chrono:: Duration :: max_value ( ) )
11+ chrono:: Duration :: from_std ( std_duration) . unwrap_or ( chrono:: Duration :: MAX )
1212}
1313
1414/// Returns the ordinal string of a given integer
You can’t perform that action at this time.
0 commit comments