Skip to content

Commit 96aa630

Browse files
committed
chore: clear up duplicate code
1 parent f43c14c commit 96aa630

File tree

3 files changed

+9
-25
lines changed

3 files changed

+9
-25
lines changed

crates/tap-agent/src/actor_migrate.rs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -84,24 +84,8 @@ impl<T> Clone for TaskHandle<T> {
8484
}
8585

8686
impl<T> TaskHandle<T> {
87-
/// Create a new task handle for testing
88-
#[cfg(any(test, feature = "test"))]
89-
pub fn new_for_test(
90-
tx: mpsc::Sender<T>,
91-
name: Option<String>,
92-
lifecycle: Arc<LifecycleManager>,
93-
) -> Self {
94-
Self {
95-
tx,
96-
task_id: TaskId::new(),
97-
name,
98-
lifecycle,
99-
}
100-
}
101-
102-
/// Create a new task handle for production use
103-
#[cfg(not(any(test, feature = "test")))]
104-
pub fn new_for_production(
87+
/// Create a new task handle
88+
pub fn new(
10589
tx: mpsc::Sender<T>,
10690
name: Option<String>,
10791
lifecycle: Arc<LifecycleManager>,

crates/tap-agent/src/agent/sender_account_task.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ impl SenderAccountTask {
398398
{
399399
// Create a self-reference handle for the child to communicate back
400400
let (self_tx, mut self_rx) = mpsc::channel::<SenderAccountMessage>(10);
401-
let self_handle = TaskHandle::new_for_test(
401+
let self_handle = TaskHandle::new(
402402
self_tx,
403403
Some(format!("sender_account_{}", state.sender)),
404404
state.lifecycle.clone(),
@@ -482,8 +482,8 @@ impl SenderAccountTask {
482482
// Create a self-reference handle for the child to communicate back
483483
let (self_tx, self_rx) = mpsc::channel::<SenderAccountMessage>(10);
484484

485-
// Create proper TaskHandle for production
486-
let self_handle = TaskHandle::new_for_production(
485+
// Create TaskHandle for production
486+
let self_handle = TaskHandle::new(
487487
self_tx,
488488
Some(format!("sender_account_{}", state.sender)),
489489
state.lifecycle.clone(),

crates/tap-agent/src/agent/sender_allocation_task.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ mod tests {
10951095

10961096
// Create a dummy parent handle for testing
10971097
let (parent_tx, mut parent_rx) = mpsc::channel(10);
1098-
let parent_handle = TaskHandle::new_for_test(
1098+
let parent_handle = TaskHandle::new(
10991099
parent_tx,
11001100
Some("test_parent".to_string()),
11011101
std::sync::Arc::new(lifecycle.clone()),
@@ -1157,7 +1157,7 @@ mod tests {
11571157

11581158
// Create a dummy parent handle for testing
11591159
let (parent_tx, mut parent_rx) = mpsc::channel(10);
1160-
let parent_handle = TaskHandle::new_for_test(
1160+
let parent_handle = TaskHandle::new(
11611161
parent_tx,
11621162
Some("test_parent".to_string()),
11631163
std::sync::Arc::new(lifecycle.clone()),
@@ -1257,7 +1257,7 @@ mod tests {
12571257

12581258
// Create a dummy parent handle for testing
12591259
let (parent_tx, mut parent_rx) = mpsc::channel(10);
1260-
let parent_handle = TaskHandle::new_for_test(
1260+
let parent_handle = TaskHandle::new(
12611261
parent_tx,
12621262
Some("test_parent".to_string()),
12631263
std::sync::Arc::new(lifecycle.clone()),
@@ -1362,7 +1362,7 @@ mod tests {
13621362

13631363
// Create a dummy parent handle for testing
13641364
let (parent_tx, mut parent_rx) = mpsc::channel(10);
1365-
let parent_handle = TaskHandle::new_for_test(
1365+
let parent_handle = TaskHandle::new(
13661366
parent_tx,
13671367
Some("test_parent".to_string()),
13681368
std::sync::Arc::new(lifecycle.clone()),

0 commit comments

Comments
 (0)