It would be good if the serve (and/or maybe worker_serve) functions can accept a callback (or any other mechanism) to signal readiness to its caller. Something similar to anyio's TaskStatus, an Event or a pure callback. Maybe an Event is the easiest.
The problem is that this function is supposed to run forever, so when it's integrated in an application, we can't distinguish between "we are still starting up and still have to bind the socket (but will possibly fail soon due to port already in use)" and "we're up and running".
If you are only concerned about binding you could perform the bind yourself and pass the fds to the config object.
Apart from that there are also the lifespan events like startup and startup.complete
It would be good if the
serve
(and/or maybeworker_serve
) functions can accept a callback (or any other mechanism) to signal readiness to its caller. Something similar toanyio
'sTaskStatus
, anEvent
or a pure callback. Maybe anEvent
is the easiest.The problem is that this function is supposed to run forever, so when it's integrated in an application, we can't distinguish between "we are still starting up and still have to bind the socket (but will possibly fail soon due to port already in use)" and "we're up and running".