Skip to content

Commit

Permalink
reorder methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jacovdbergh committed Oct 31, 2024
1 parent 7ad937d commit 84b6b2a
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,6 @@ pub async fn start<H: Hooks>(
Ok(())
}

async fn shutdown_and_await_queue_worker(
app_context: &AppContext,
handle: JoinHandle<()>,
) -> Result<(), Error> {
if let Some(queue) = &app_context.queue_provider {
queue.shutdown()?;
}

println!("press ctrl-c again to force quit");
select! {
_ = handle => {}
() = shutdown_signal() => {}
}
Ok(())
}

fn start_queue_worker(app_context: &AppContext) -> Result<JoinHandle<()>> {
debug!("note: worker is run in-process (tokio spawn)");

Expand All @@ -146,6 +130,22 @@ fn start_queue_worker(app_context: &AppContext) -> Result<JoinHandle<()>> {
Err(Error::QueueProviderMissing)
}

async fn shutdown_and_await_queue_worker(
app_context: &AppContext,
handle: JoinHandle<()>,
) -> Result<(), Error> {
if let Some(queue) = &app_context.queue_provider {
queue.shutdown()?;
}

println!("press ctrl-c again to force quit");
select! {
_ = handle => {}
() = shutdown_signal() => {}
}
Ok(())
}

/// Run task
///
/// # Errors
Expand Down

0 comments on commit 84b6b2a

Please sign in to comment.