File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
data-pipeline/src/agent_info Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -522,15 +522,32 @@ mod single_threaded_tests {
522
522
response_observer. check_response ( & response) ;
523
523
524
524
// Wait for the fetch to complete
525
+ const MAX_ATTEMPTS : u32 = 500 ;
526
+ const SLEEP_DURATION_MS : u64 = 10 ;
527
+
525
528
let mut attempts = 0 ;
526
- while mock. hits_async ( ) . await == 0 && attempts < 50 {
529
+ while mock. hits_async ( ) . await == 0 && attempts < MAX_ATTEMPTS {
527
530
attempts += 1 ;
528
- tokio:: time:: sleep ( Duration :: from_millis ( 100 ) ) . await ;
531
+ tokio:: time:: sleep ( Duration :: from_millis ( SLEEP_DURATION_MS ) ) . await ;
529
532
}
530
533
531
534
// Should trigger a fetch since the state is different
532
535
mock. assert_hits_async ( 1 ) . await ;
533
536
537
+ // Wait for the cache to be updated with proper timeout
538
+ let mut attempts = 0 ;
539
+
540
+ while attempts < MAX_ATTEMPTS {
541
+ let updated_info = AGENT_INFO_CACHE . load ( ) ;
542
+ if let Some ( info) = updated_info. as_ref ( ) {
543
+ if info. state_hash == "new_state" {
544
+ break ;
545
+ }
546
+ }
547
+ attempts += 1 ;
548
+ tokio:: time:: sleep ( Duration :: from_millis ( SLEEP_DURATION_MS ) ) . await ;
549
+ }
550
+
534
551
// Verify the cache was updated
535
552
let updated_info = AGENT_INFO_CACHE . load ( ) ;
536
553
assert ! ( updated_info. is_some( ) ) ;
You can’t perform that action at this time.
0 commit comments