@@ -145,7 +145,7 @@ where
145
145
let should_prune = {
146
146
let last_pruning = self . last_pruning . lock ( ) . unwrap ( ) ;
147
147
last_pruning. as_ref ( ) . map_or ( true , |last_time| {
148
- now. abs_diff ( & last_time) > PRUNE_STALE_WEBHOOKS_INTERVAL_DAYS . as_secs ( )
148
+ now. duration_since ( & last_time) > PRUNE_STALE_WEBHOOKS_INTERVAL_DAYS
149
149
} )
150
150
} ;
151
151
@@ -392,10 +392,9 @@ where
392
392
if webhook
393
393
. last_notification_sent
394
394
. get ( & notification. method )
395
- . map ( |last_sent| now. clone ( ) . abs_diff ( & last_sent) )
396
- . map_or ( true , |duration| {
397
- duration >= self . config . notification_cooldown_hours . as_secs ( )
398
- } ) {
395
+ . map ( |last_sent| now. clone ( ) . duration_since ( & last_sent) )
396
+ . map_or ( true , |duration| duration >= self . config . notification_cooldown_hours )
397
+ {
399
398
webhook. last_notification_sent . insert ( notification. method . clone ( ) , now. clone ( ) ) ;
400
399
webhook. last_used = now. clone ( ) ;
401
400
self . send_notification (
@@ -462,7 +461,7 @@ where
462
461
webhooks. retain ( |client_id, client_webhooks| {
463
462
if !self . client_has_open_channel ( client_id) {
464
463
client_webhooks. retain ( |_, webhook| {
465
- now. abs_diff ( & webhook. last_used ) < MIN_WEBHOOK_RETENTION_DAYS . as_secs ( )
464
+ now. duration_since ( & webhook. last_used ) < MIN_WEBHOOK_RETENTION_DAYS
466
465
} ) ;
467
466
!client_webhooks. is_empty ( )
468
467
} else {
0 commit comments