File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ use rand::{thread_rng, Rng};
10
10
use serde:: ser:: SerializeStruct ;
11
11
use serde:: { Serialize , Serializer } ;
12
12
13
- use time:: { OffsetDateTime , Duration } ;
13
+ use time:: { Duration , OffsetDateTime } ;
14
14
15
15
const REDIS_URL_ENV : & str = "REDIS_URL" ;
16
16
const REDIS_URL_DEFAULT : & str = "redis://127.0.0.1/" ;
@@ -205,7 +205,11 @@ impl Client {
205
205
let div: f64 = 1_000_f64 ;
206
206
let maximum_target: f64 = 1_000_000_000_f64 ;
207
207
let target_millsec: f64 = target_millsec_number / div;
208
- let now_millisec = SystemTime :: now ( ) . duration_since ( UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as f64 / div;
208
+ let now_millisec = SystemTime :: now ( )
209
+ . duration_since ( UNIX_EPOCH )
210
+ . unwrap ( )
211
+ . as_secs ( ) as f64
212
+ / div;
209
213
210
214
let start_at: f64 = if target_millsec < maximum_target {
211
215
now_millisec + target_millsec
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
8
8
use serde_json:: value:: Value ;
9
9
use sidekiq:: { create_redis_pool, Client , ClientOpts , Job } ;
10
10
11
- use time:: { OffsetDateTime , Duration } ;
11
+ use time:: { Duration , OffsetDateTime } ;
12
12
13
13
fn args ( ) -> Vec < Value > {
14
14
let value = json ! ( {
@@ -129,7 +129,9 @@ fn test_client_perform_at() {
129
129
let class = "MyClass" . to_string ( ) ;
130
130
let job = Job :: new ( class, args ( ) , Default :: default ( ) ) ;
131
131
let client = get_client ( ) ;
132
- let start_at = OffsetDateTime :: now_utc ( ) . checked_add ( Duration :: HOUR ) . unwrap ( ) ;
132
+ let start_at = OffsetDateTime :: now_utc ( )
133
+ . checked_add ( Duration :: HOUR )
134
+ . unwrap ( ) ;
133
135
match client. perform_at ( start_at, job) {
134
136
Ok ( _) => { }
135
137
Err ( err) => {
You can’t perform that action at this time.
0 commit comments