Skip to content

Commit 90a4fe1

Browse files
committed
Drop Runtime::spawn in favor of spawn_cancellable_background_task
We now drop the generic `spawn` from our internal `Runtime` API, ensuring we'd always have to either use `spawn_cancellable_background_task` or `spawn_background_task`.
1 parent 4922e8d commit 90a4fe1

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ where
10591059
forwarding_channel_manager.process_pending_htlc_forwards();
10601060
};
10611061

1062-
self.runtime.spawn(future);
1062+
self.runtime.spawn_cancellable_background_task(future);
10631063
},
10641064
LdkEvent::SpendableOutputs { outputs, channel_id } => {
10651065
match self.output_sweeper.track_spendable_outputs(outputs, channel_id, true, None) {
@@ -1441,7 +1441,7 @@ where
14411441
}
14421442
}
14431443
};
1444-
self.runtime.spawn(future);
1444+
self.runtime.spawn_cancellable_background_task(future);
14451445
},
14461446
LdkEvent::BumpTransaction(bte) => {
14471447
match bte {

src/gossip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,6 @@ impl RuntimeSpawner {
144144

145145
impl FutureSpawner for RuntimeSpawner {
146146
fn spawn<T: Future<Output = ()> + Send + 'static>(&self, future: T) {
147-
self.runtime.spawn(future);
147+
self.runtime.spawn_cancellable_background_task(future);
148148
}
149149
}

src/runtime.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,6 @@ impl Runtime {
6161
}
6262
}
6363

64-
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
65-
where
66-
F: Future + Send + 'static,
67-
F::Output: Send + 'static,
68-
{
69-
let handle = self.handle();
70-
handle.spawn(future)
71-
}
72-
7364
pub fn spawn_background_task<F>(&self, future: F)
7465
where
7566
F: Future<Output = ()> + Send + 'static,

0 commit comments

Comments
 (0)