You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there, I've noticed that there has been a change somewhat recently whereby a server created via app.create_server now no longer triggers events. The source of the difference is here, in server.py:
The serve function returns prior to triggering any events. Just wondering whether this was intended or not? And if so, why? I have some testing code I use that depended on running a server in the background and having the events triggered. I'm sure I can update it, but just wanted to confirm this is the intended behaviour.
Thanks!
Edit: If this is intended, would you be able to recommend the correct way to launch events for a background server?
The text was updated successfully, but these errors were encountered:
It was a bug before, it would trigger before_start events twice when starting gunicorn worker. That's the reason we move the code.
Also, trigger_events(before_start, loop) is sort of sync way for triggering events. I am thinking when we start server asynchronously, we should also trigger events asynchronously.
User can easily do the triggering. But i can push a quick fix for that.
PS: app.create_server is not preferred to start Sanic app. For testing, we started Server and triggered all events asynchronously.
@yunstanford Thanks for the quick response! Please don't feel rushed, I've got a workaround that is easy enough for my case, so there's no rush.
I'm not using app.create_server for production usage, just for testing purposes. I've combined it with asynctest, seems to be working reasonably well at the moment.
Hi there, I've noticed that there has been a change somewhat recently whereby a server created via
app.create_server
now no longer triggers events. The source of the difference is here, inserver.py
:The
serve
function returns prior to triggering any events. Just wondering whether this was intended or not? And if so, why? I have some testing code I use that depended on running a server in the background and having the events triggered. I'm sure I can update it, but just wanted to confirm this is the intended behaviour.Thanks!
Edit: If this is intended, would you be able to recommend the correct way to launch events for a background server?
The text was updated successfully, but these errors were encountered: