@@ -402,15 +402,14 @@ where
402
402
403
403
// Get a better estimate of total count by running a query with a large limit
404
404
// This is not perfect but gives a more accurate total than just the current page
405
- let total = if jobs. len ( ) as u64 == pagination. limit {
405
+ let total = if jobs. len ( ) as u64 == pagination. limit . unwrap_or ( 0 ) as u64 {
406
406
// If we got exactly the limit, there might be more records
407
407
// Run another query to get a better count estimate
408
408
match queue
409
409
. list_archived_jobs (
410
410
filters. queue . as_deref ( ) ,
411
411
Some ( 10000 ) ,
412
412
Some ( 0 ) ,
413
- filters. older_than ,
414
413
)
415
414
. await
416
415
{
@@ -419,7 +418,7 @@ where
419
418
}
420
419
} else {
421
420
// If we got less than the limit, we have all records
422
- pagination. offset + jobs. len ( ) as u64
421
+ pagination. offset . unwrap_or ( 0 ) as u64 + jobs. len ( ) as u64
423
422
} ;
424
423
425
424
let pagination_meta = PaginationMeta :: new ( & pagination, total) ;
@@ -483,7 +482,7 @@ where
483
482
// For dry run, estimate how many jobs would be purged by using list_archived_jobs
484
483
// with a large limit to get an accurate count
485
484
let count = match queue
486
- . list_archived_jobs ( None , Some ( 10000 ) , Some ( 0 ) , request . older_than )
485
+ . list_archived_jobs ( None , Some ( 10000 ) , Some ( 0 ) )
487
486
. await
488
487
{
489
488
Ok ( jobs) => jobs. len ( ) as u64 ,
@@ -544,14 +543,18 @@ where
544
543
let recent_operations = vec ! [
545
544
RecentOperation {
546
545
operation_type: "archive" . to_string( ) ,
547
- jobs_count: stats. jobs_archived,
548
- timestamp: chrono:: Utc :: now( ) - chrono:: Duration :: hours( 2 ) ,
546
+ jobs_affected: stats. jobs_archived,
547
+ executed_at: chrono:: Utc :: now( ) - chrono:: Duration :: hours( 2 ) ,
548
+ executed_by: Some ( "system" . to_string( ) ) ,
549
+ reason: Some ( "Automated archival" . to_string( ) ) ,
549
550
queue_name: filters. queue. clone( ) ,
550
551
} ,
551
552
RecentOperation {
552
553
operation_type: "purge" . to_string( ) ,
553
- jobs_count: stats. jobs_purged,
554
- timestamp: chrono:: Utc :: now( ) - chrono:: Duration :: hours( 4 ) ,
554
+ jobs_affected: stats. jobs_purged,
555
+ executed_at: chrono:: Utc :: now( ) - chrono:: Duration :: hours( 4 ) ,
556
+ executed_by: Some ( "system" . to_string( ) ) ,
557
+ reason: Some ( "Automated purge" . to_string( ) ) ,
555
558
queue_name: filters. queue. clone( ) ,
556
559
} ,
557
560
] ;
0 commit comments