Skip to content

Commit

Permalink
make uvloop optional
Browse files Browse the repository at this point in the history
  • Loading branch information
AbstractUmbra committed Jul 14, 2024
1 parent b1f83e9 commit 9302a63
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import uvicorn

has_uvloop = True
try:
import uvloop as uvloop
except ModuleNotFoundError:
has_uvloop = False


if __name__ == "__main__":
uvicorn.run(
"anilist-cmp:app",
host="0.0.0.0",
port=8080,
workers=2,
loop="uvloop",
loop="uvloop" if has_uvloop else "auto",
proxy_headers=True,
server_header=True,
date_header=True,
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ python = "^3.12"
litestar = "*"
uvicorn = "*"
pillow = "*"

[tool.poetry.group.speed.dependencies]
uvloop = "*"

[tool.poetry.group.dev.dependencies]
Expand Down

0 comments on commit 9302a63

Please sign in to comment.