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

Unique Worker ID #2529

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Prev Previous commit
fix condition
  • Loading branch information
whilenot-dev committed Dec 5, 2024
commit 7be3aeaecb64c7d252b07b4940a61124b7322cc8
2 changes: 1 addition & 1 deletion uvicorn/lifespan/on.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def main(self) -> None:

# inject worker id into app state
uvicorn_worker_id = cast(Optional[int], self.state.get("uvicorn_worker_id"))
if uvicorn_worker_id is not None and hasattr(app.app, "__iter__") and "state" in app.app:
if uvicorn_worker_id is not None and hasattr(app.app, "state"):
app.app.state.uvicorn_worker_id = uvicorn_worker_id

scope: LifespanScope = {
Expand Down
Loading
  NODES
COMMUNITY 2
Note 1
Project 2
USERS 1