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

Import app factory before retrieving ioloop fix #156 #157

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aiohttp_devtools/runserver/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ def serve_main_app(config: Config, tty_path: Optional[str], loop: asyncio.Abstra
with set_tty(tty_path):
setup_logging(config.verbose)

# imports the factory. This gives users a chance to register alternative event loops
config.app_factory
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not your fault, but this looks dumb and isn't clear.

If we decide to merge this I think it would be better to remove the app_factory property and rename _import_app_factory > import_app_factory and use that instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that making that function public would be a better option. Want me to refactor the function?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, regarding my problem, namely being able to set my own event loop, and not use the standard one - details are in the issue #156

There are no other details that I can provide - basically I don't know of a nice way to make the runserver command use the event loop that I want.

If you can suggest a better way, that' fine. I haven't investigated that much, so I don't have an overview of the project's structure.

Until then, the problem remains valid, and both the traceback of the error, and the code that generated it can be found in the issue.

Thanks for your time! :)


loop = loop or asyncio.get_event_loop()

app = config.load_app(loop)
Expand Down