()
| 2656 | |
| 2657 | #[test] |
| 2658 | fn test_has_flushable_work() { |
| 2659 | let mut q = EventQueue::new(DedupMode::Queue); |
| 2660 | let ch = Uuid::new_v4(); |
| 2661 | |
| 2662 | // Empty queue — no flushable work. |
| 2663 | assert!(!q.has_flushable_work()); |
| 2664 | |
| 2665 | q.push(make_queued(ch, "msg")); |
| 2666 | assert!(q.has_flushable_work()); |
| 2667 | |
| 2668 | // Flush — now in-flight, no flushable work. |
| 2669 | let _batch = q.flush_next().expect("flush"); |
| 2670 | assert!(!q.has_flushable_work()); |
| 2671 | |
| 2672 | // Complete — no pending events, no flushable work. |
| 2673 | q.mark_complete(ch); |
| 2674 | assert!(!q.has_flushable_work()); |
| 2675 | |
| 2676 | // Requeue with retry_after — throttled, no flushable work. |
| 2677 | q.push(make_queued(ch, "msg2")); |
| 2678 | let batch2 = q.flush_next().expect("flush2"); |
| 2679 | q.requeue(batch2); |
| 2680 | q.mark_complete(ch); |
| 2681 | assert!( |
| 2682 | !q.has_flushable_work(), |
| 2683 | "throttled channel should not be flushable" |
| 2684 | ); |
| 2685 | |
| 2686 | // Manually expire the retry_after to simulate time passing. |
| 2687 | q.retry_after |
| 2688 | .insert(ch, Instant::now() - Duration::from_secs(1)); |
| 2689 | assert!( |
| 2690 | q.has_flushable_work(), |
| 2691 | "expired throttle should be flushable" |
| 2692 | ); |
| 2693 | } |
| 2694 | |
| 2695 | #[test] |
| 2696 | fn test_requeue_dead_letters_after_max_retries() { |
nothing calls this directly
no test coverage detected