#2316·mopidy

Send lifespan events to ASGI apps

Author: jodalCreated Sep 27, 2026Updated Sep 27, 2026
LabelsA-ext-httpready-for-agent

:robot: Summary

ASGI apps registered with http:asgi get lifespan events, so they can open and close resources in the usual way. See "Lifespan" in the parent spec.

Parent

mopidy/mopidy#2312

Acceptance criteria

  • When the HTTP frontend starts, each ASGI app gets lifespan.startup, and the server does not accept connections before the reply.
  • On lifespan.startup.failed or an exception, Mopidy logs the error and does not mount that app. Other apps still work.
  • When the HTTP frontend stops, each mounted ASGI app gets lifespan.shutdown, and the frontend waits for the reply.
  • Apps that do not support lifespan still work, as the ASGI spec says.

Blocked by

  • mopidy/mopidy#2314