Skip to content

fix: replace sleep-based synchronization with condition polling in tests - #2945

Merged
oferchen merged 1 commit into
masterfrom
fix/sleep-to-condition-polling
Mar 22, 2026
Merged

oferchen merged 1 commit into
masterfrom
fix/sleep-to-condition-polling

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Replace single 10ms thread::sleep in daemon startup check (crates/core/tests/common/mod.rs) with a polling loop that checks try_wait() every 10ms for up to 500ms, catching early exits reliably on slow CI runners.
  • Replace 10ms thread::sleep in SPSC backpressure test (crates/transfer/src/pipeline/spsc.rs) with an AtomicBool flag and yield_now()-based polling (5s deadline), so the drain thread waits for an explicit signal instead of relying on timing.
  • All remaining thread::sleep calls in tests are intentional delays (elapsed time measurement, rate-limiting time gaps, mtime backdating) or already use proper condition-based polling loops.

Closes #1331

Test plan

  • CI passes on all platforms (Linux, macOS, Windows)
  • cargo nextest run -p oc-rsync-core --all-features -E 'test(daemon)' passes
  • cargo nextest run -p oc-rsync-transfer --all-features -E 'test(backpressure)' passes

@oferchen
oferchen merged commit a92563b into master Mar 22, 2026
5 of 10 checks passed
@oferchen
oferchen deleted the fix/sleep-to-condition-polling branch March 22, 2026 09:38
@github-actions github-actions Bot added the bug Something isn't working label Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant