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

Prevent the debug server from setting up its own event loop #945

Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Release type: patch

This releases fixes an issue with the debug server that prevented the
usage of dataloaders, see: https://github.com/strawberry-graphql/strawberry/issues/940
2 changes: 1 addition & 1 deletion strawberry/cli/commands/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def server(schema, host, port, app_dir):
app.add_websocket_route(path, graphql_app)

print(f"Running strawberry on http://{host}:{port}/ 🍓")
uvicorn.run(app, host=host, port=port, log_level="error")
uvicorn.run(app, loop="none", host=host, port=port, log_level="error")
Copy link
Member

Choose a reason for hiding this comment

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

Is this documented in the uvicorn docs? I was only able to find it here: https://github.com/encode/uvicorn/blob/bf1c64e2c141971c546671c7dc91b8ccf0afeb7d/uvicorn/config.py#L55-L60

I'll test this with the dataloader example and see if it works :)

Thank you!

Copy link
Member Author

Choose a reason for hiding this comment

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

It appears to be undocumented on their website which matches the uvicorn cli help command. Maybe it was intended for programmatically usage only. However, according to this PR they added it specifically to allow the setup of custom event loops.