Skip to content

Commit 22a9e8b

Browse files
committed
bugfix: Account for local queue corner cases
It turns out that with the current strategy it is possible for tasks to be stuck in the local queue without any hope of being picked back up. In practice this seems to happen when the only entities polling the system are tickers, as opposed to runners. Since tickets don't steal tasks, it is possible for tasks to be left over in the local queue that don't filter out. One possible solution is to make it so tickers steal tasks, but this kind of defeats the point of tickers. So I've instead elected to replace the current strategy with one that accounts for the corner cases with local queues. The main difference is that I replace the Sleepers struct with two event_listener::Event's. One that handles tickers subscribed to the global queue and one that handles tickers subscribed to the local queue. The other main difference is that each local queue now has a reference counter. If this count reaches zero, no tasks will be pushed to this queue. Only runners increment or decrement this counter. This makes the previously instituted tests pass, so hopefully this works for most use cases. Signed-off-by: John Nunley <[email protected]>
1 parent d5dc7a8 commit 22a9e8b

File tree

3 files changed

+111
-260
lines changed

3 files changed

+111
-260
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ exclude = ["/.*"]
1717
[dependencies]
1818
async-lock = "3.0.0"
1919
async-task = "4.4.0"
20-
atomic-waker = "1.0"
2120
concurrent-queue = "2.0.0"
21+
event-listener = { version = "5.2.0", default-features = false, features = ["std"] }
2222
fastrand = "2.0.0"
2323
futures-lite = { version = "2.0.0", default-features = false }
2424
slab = "0.4.4"

0 commit comments

Comments
 (0)