Skip to main content

Module SpawnBindTaskWithShutdown

Module SpawnBindTaskWithShutdown 

Source
Expand description

Spawn a detached tokio task that serves a tonic gRPC Router with graceful shutdown signalling.

Uses tonic::transport::Server::serve_with_shutdown(...) so daemon- style embedders can drain in-flight RPCs before exiting. The simpler crate::Server::SpawnBindTask::Fn runs without a shutdown signal; both shapes are kept side-by-side so embedders pick whichever matches their lifecycle model.

§Lifecycle

  • The task runs until ShutdownSignal resolves OR the OS socket closes.
  • On Ok(()) exit, dev_log marks clean shutdown.
  • On Err, dev_log captures the transport error.

§Choosing between the two helpers

NeedHelper
Serve until process terminationSpawnBindTask
Serve until a signal fires (recommended for daemons)SpawnBindTaskWithShutdown

Functions§

Fn
Spawn a detached tokio task that serves Router on Address until ShutdownSignal resolves.