@@ -368,7 +368,7 @@ mod tests {
368368 // All entries expired
369369 }
370370
371- // assert_eventually checks a condition every 10ms for a maximum of timeout
371+ // assert_eventually checks a condition every 2ms for a maximum of timeout
372372 async fn assert_eventually < F > ( assertion : F , timeout : Duration )
373373 where
374374 F : Fn ( ) -> bool ,
@@ -378,17 +378,16 @@ mod tests {
378378 if assertion ( ) {
379379 return ;
380380 }
381- tokio:: time:: sleep ( Duration :: from_millis ( 10 ) ) . await ;
381+ tokio:: time:: sleep ( Duration :: from_millis ( 2 ) ) . await ;
382382 }
383383 panic ! ( "Assertion failed within {:?}" , timeout) ;
384384 }
385385
386386 #[ tokio:: test( flavor = "multi_thread" , worker_threads = 8 ) ]
387- #[ ignore] // the test is flaky, uncomment once flakyness is solved
388387 async fn test_concurrent_gc_and_access ( ) {
389388 let ttl_map = TTLMap :: < String , i32 > :: try_new ( TTLMapConfig {
390- ttl : Duration :: from_millis ( 10 ) ,
391- tick : Duration :: from_millis ( 2 ) ,
389+ ttl : Duration :: from_millis ( 50 ) ,
390+ tick : Duration :: from_millis ( 10 ) ,
392391 } )
393392 . unwrap ( ) ;
394393
@@ -421,7 +420,11 @@ mod tests {
421420 handle. await . unwrap ( ) ;
422421 }
423422
424- assert_eventually ( || ttl_map. data . is_empty ( ) , Duration :: from_millis ( 20 ) ) . await ;
423+ // Allow time for pending bucket registration messages to be processed
424+ tokio:: time:: sleep ( Duration :: from_millis ( 10 ) ) . await ;
425+
426+ // Wait for GC to clear all entries (5× TTL to account for scheduling delays)
427+ assert_eventually ( || ttl_map. data . is_empty ( ) , Duration :: from_millis ( 250 ) ) . await ;
425428 }
426429
427430 #[ tokio:: test]
0 commit comments