@@ -363,7 +363,12 @@ impl Handler<GarbageCollectMessage> for GarbageCollector {
363
363
. sysdb_client
364
364
. get_collections_to_gc (
365
365
Some ( version_absolute_cutoff_time. into ( ) ) ,
366
- Some ( self . config . max_collections_to_gc . into ( ) ) ,
366
+ Some (
367
+ self . config
368
+ . max_collections_to_fetch
369
+ . unwrap_or ( self . config . max_collections_to_gc )
370
+ . into ( ) ,
371
+ ) ,
367
372
message. tenant . clone ( ) ,
368
373
self . config . filter_min_versions_if_alive ,
369
374
)
@@ -395,7 +400,9 @@ impl Handler<GarbageCollectMessage> for GarbageCollector {
395
400
}
396
401
397
402
true
398
- } ) . collect :: < Vec < _ > > ( ) ;
403
+ } )
404
+ . take ( self . config . max_collections_to_gc as usize )
405
+ . collect :: < Vec < _ > > ( ) ;
399
406
400
407
tracing:: info!(
401
408
"Filtered to {} collections to garbage collect" ,
@@ -728,6 +735,7 @@ mod tests {
728
735
version_cutoff_time : Duration :: from_secs ( 1 ) ,
729
736
collection_soft_delete_grace_period : Duration :: from_secs ( 1 ) ,
730
737
max_collections_to_gc : 100 ,
738
+ max_collections_to_fetch : None ,
731
739
gc_interval_mins : 10 ,
732
740
disallow_collections : HashSet :: new ( ) ,
733
741
min_versions_to_keep : 2 ,
@@ -865,6 +873,7 @@ mod tests {
865
873
version_cutoff_time : Duration :: from_secs ( 1 ) ,
866
874
collection_soft_delete_grace_period : Duration :: from_secs ( 1 ) ,
867
875
max_collections_to_gc : 100 ,
876
+ max_collections_to_fetch : None ,
868
877
min_versions_to_keep : 2 ,
869
878
filter_min_versions_if_alive : None ,
870
879
gc_interval_mins : 10 ,
0 commit comments