Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Commit 2a19236

Browse files
authored
refactor task bridge to handle async tasks concurrently, preventing potential duplicate submission (#600)
1 parent c29623e commit 2a19236

6 files changed

Lines changed: 361 additions & 237 deletions

File tree

.github/workflows/checks.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ env:
1818
LANG: C.UTF-8
1919
LC_ALL: C.UTF-8
2020

21-
2221
jobs:
2322
check:
2423
name: Format & Lint
@@ -57,4 +56,4 @@ jobs:
5756
if: success() || failure()
5857
run: |
5958
redis-server --version
60-
RUST_BACKTRACE=1 cargo test -- --nocapture
59+
RUST_BACKTRACE=1 cargo test -- --nocapture

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/worker/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ anyhow = { workspace = true }
3434
thiserror = "2.0.11"
3535
toml = { workspace = true }
3636
ctrlc = "3.4.5"
37-
tokio-util = { workspace = true }
37+
tokio-util = { workspace = true, features = ["rt"] }
3838
futures = { workspace = true }
3939
chrono = { workspace = true }
4040
serial_test = "0.5.1"
@@ -55,4 +55,5 @@ iroh = { workspace = true }
5555
rand_v8 = { workspace = true }
5656
rand_core_v6 = { workspace = true }
5757
dashmap = "6.1.0"
58+
tokio-stream = { version = "0.1.17", features = ["net"] }
5859
homedir = "0.3"

crates/worker/src/cli/command.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub async fn execute_command(
453453
gpu,
454454
system_memory,
455455
task_bridge
456-
.socket_path
456+
.get_socket_path()
457457
.to_str()
458458
.expect("path is valid utf-8 string")
459459
.to_string(),
@@ -469,11 +469,10 @@ pub async fn execute_command(
469469

470470
let bridge_cancellation_token = cancellation_token.clone();
471471
tokio::spawn(async move {
472-
let bridge_clone = task_bridge.clone();
473472
tokio::select! {
474473
_ = bridge_cancellation_token.cancelled() => {
475474
}
476-
_ = bridge_clone.run() => {
475+
_ = task_bridge.run() => {
477476
}
478477
}
479478
});

0 commit comments

Comments
 (0)