Skip to content

Commit 5274b2c

Browse files
da2ce7josecelano
authored andcommitted
fix: [#74] send api ready event after starting the api server
Cameron Garnham (@da2ce7) suggested this change. It's better to send the event after spwaning the API server task.
1 parent 15aa831 commit 5274b2c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/jobs/tracker_api.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,13 @@ pub async fn start_job(config: &Configuration, tracker: Arc<TorrentTracker>) ->
2424

2525
// Run the API server
2626
let join_handle = tokio::spawn(async move {
27+
let handel = server::start(bind_addr, tracker);
28+
2729
if tx.send(ApiServerJobStarted()).is_err() {
2830
panic!("the start job dropped");
2931
}
30-
server::start(bind_addr, tracker).await;
32+
33+
handel.await;
3134
});
3235

3336
// Wait until the API server job is running

0 commit comments

Comments
 (0)