Skip to content

Fix bug in draining non-factory-queued routing#353

Merged
slawlor merged 3 commits intomainfrom
docs
May 7, 2025
Merged

Fix bug in draining non-factory-queued routing#353
slawlor merged 3 commits intomainfrom
docs

Conversation

@slawlor
Copy link
Owner

@slawlor slawlor commented May 7, 2025

When the queueing occurs on workers directly, the factory wasn't tracking the in-flight message count correctly, such that the worker might still have work in-flight when requesting a draining operation.

This change fixes 2 things

  1. The evaluation of if a worker is "empty" of all jobs, i.e. drained, by checking the current & queued jobs
  2. The tracking of the current job on the worker, when a worker has locally dequeued the next job.

Test coverage added for this scenario. Prior to the fix, the added test fails with

thread 'factory::tests::draining_requests::test_worker_drains_when_worker_queueing' panicked at ractor/src/factory/tests/draining_requests.rs:221:5:
assertion `left == right` failed
  left: 999
 right: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

since the factory was marked "drained" prior to all messages completing. Now it passes with this patch.

Also docs updated.

slawlor added 3 commits May 7, 2025 09:37
When the queueing occurs on workers directly, the factory wasn't tracking the in-flight message count correctly, such that the worker might still have work in-flight when requesting a draining operation.

This change fixes 2 things

1. The evaluation of if a worker is "empty" of all jobs, i.e. drained
2. The tracking of the current job on the worker, when a worker has locally dequeued the next job.

Test coverage added for this scenario. Prior to the fix, the added test fails with

```
thread 'factory::tests::draining_requests::test_worker_drains_when_worker_queueing' panicked at ractor/src/factory/tests/draining_requests.rs:221:5:
assertion `left == right` failed
  left: 999
 right: 1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
```
@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

Attention: Patch coverage is 92.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 80.99%. Comparing base (642bdcd) to head (ae4c55e).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
ractor/src/factory/tests/draining_requests.rs 91.48% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #353      +/-   ##
==========================================
+ Coverage   80.95%   80.99%   +0.03%     
==========================================
  Files          70       70              
  Lines       14367    14415      +48     
==========================================
+ Hits        11631    11675      +44     
- Misses       2736     2740       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@slawlor slawlor marked this pull request as ready for review May 7, 2025 14:24
@slawlor slawlor merged commit 46ac951 into main May 7, 2025
21 checks passed
@slawlor slawlor deleted the docs branch May 7, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant