Skip to main content

serve

Function serve 

Source
pub async fn serve(
    harness: Arc<Harness>,
    runtime: Native,
) -> Result<(), ServeError>
Expand description

Serves the harness: builds the router once, wraps it in the client-IP middleware, starts the cron scheduler for the CRONS config, and serves until SIGTERM or SIGINT.

§Errors

ServeError when LISTEN_ADDR cannot be parsed or bound, a cron expression is invalid, or the accept loop fails.

§Errors: shutdown semantics

Graceful shutdown waits for in-flight requests only. Deferred work (Defer/tokio::spawn) is not awaited on shutdown — a task killed mid-flight simply ends, like a Worker that stops getting slices after its 30 s wait_until budget. Handlers that must finish commit before responding.