-
-
Notifications
You must be signed in to change notification settings - Fork 0
[FIX] Fixes uvloop call for guvicorn worker #46
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
Conversation
e314130
to
9ce5ae6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the uvloop configuration for the guvicorn worker by introducing a custom subclass that passes the uvloop argument explicitly to the worker configuration.
- Added import for UvicornWorker from uvicorn.workers.
- Introduced a new subclass UvloopUvicornWorker with an updated uvloop configuration.
Comments suppressed due to low confidence (1)
src/settings/gunicorn.py:21
- [nitpick] Consider renaming 'UvloopUvicornWorker' to 'UVLoopUvicornWorker' to clearly indicate the 'UVLoop' acronym using uppercase, aligning with common naming conventions.
class UvloopUvicornWorker(UvicornWorker):
Caution Review failedThe pull request is closed. WalkthroughThe pull request updates the application's worker configuration. In the Dockerfile, the CMD instruction now references a new worker, switching from using Changes
Sequence Diagram(s)sequenceDiagram
participant D as Docker Container
participant G as Gunicorn Server
participant W as UvloopUvicornWorker
participant L as uvloop
D->>G: Execute CMD command
G->>W: Instantiate UvloopUvicornWorker
W->>L: Apply uvloop configuration
L-->>W: Configuration applied
W-->>G: Worker ready to handle requests
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
Dockerfile (1)
19-19
: Remove redundant--loop uvloop
parameter.The worker class
UvloopUvicornWorker
already configures uvloop through its CONFIG_KWARGS, making the--loop uvloop
parameter at the end of the command redundant. Consider removing this parameter to avoid potential conflicts.- CMD ["gunicorn", "-c", "src/settings/gunicorn.py", "-w", "1", "--threads=2", "-k", "src.settings.gunicorn.UvloopUvicornWorker", "src.api:app", "--log-level", "Debug", "-b", "0.0.0.0:3000", "--timeout", "60", "--loop", "uvloop"] + CMD ["gunicorn", "-c", "src/settings/gunicorn.py", "-w", "1", "--threads=2", "-k", "src.settings.gunicorn.UvloopUvicornWorker", "src.api:app", "--log-level", "Debug", "-b", "0.0.0.0:3000", "--timeout", "60"]
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
Dockerfile
(1 hunks)src/settings/gunicorn.py
(2 hunks)
🔇 Additional comments (2)
src/settings/gunicorn.py (2)
3-3
: Appropriate import for the worker implementation.This import is necessary for creating the custom worker class that extends UvicornWorker.
21-22
: Good implementation of a custom worker with uvloop.This is a clean implementation for ensuring uvloop is used. By extending UvicornWorker and setting CONFIG_KWARGS, you're properly configuring uvloop at the class level rather than through command-line arguments.
The merge-base changed after approval.
cf80fc9
to
4f1aeec
Compare
This PR fixes the uvloop configuration for the guvicorn worker by introducing a custom subclass that passes the uvloop argument explicitly to the worker configuration.
Added import for UvicornWorker from uvicorn.workers.
Introduced a new subclass UvloopUvicornWorker with an updated uvloop configuration.
Summary by CodeRabbit