Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Sanic 19.6.2 #127

Closed
tng10 opened this issue Aug 6, 2019 · 5 comments
Closed

Compatibility with Sanic 19.6.2 #127

tng10 opened this issue Aug 6, 2019 · 5 comments
Labels

Comments

@tng10
Copy link
Contributor

tng10 commented Aug 6, 2019

Hi,

Describe the bug

I just bumped into an error when upgrading to newest version of Sanic using ASGI interface.

Since ASGI lifespan protocol has support for only two server events, we no longer can make usage of before_server_start and after_server_stop server events.

Sanic OpenAPI uses before_server_start server event and this give us the following warning:

UserWarning: You have set a listener for "before_server_start" in ASGI mode. It will be executed as early as possible, but not before the ASGI server is started.

To Reproduce
Run Sanic using an ASGI interface

Expected behavior
Make sure this warning doesn't happen.

Environment:

  • ubuntu 18.04
  • Version [0.5.3]

On the decorator of the method build_spec at the file swagger.py I suggest the following change:

before

@blueprint.listener('before_server_start')

after

@blueprint.listener('after_server_start')

What do you think about it?

@chenjr0719
Copy link
Member

Sounds good. Would you wanna submit a PR for this?

@tng10
Copy link
Contributor Author

tng10 commented Aug 8, 2019

Yes, I'll do it.

@tng10
Copy link
Contributor Author

tng10 commented Aug 8, 2019

@chenjr0719 I just created PR #130 for it

@ahopkins
Copy link
Member

👍 Nice catch.

@stale
Copy link

stale bot commented Nov 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is incorrect, please respond with an update. Thank you for your contributions.

@stale stale bot added the stale label Nov 9, 2019
@stale stale bot closed this as completed Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants