Skip to content

Commit

Permalink
chore(deps): update to latest hypercorn version, removing workaround,…
Browse files Browse the repository at this point in the history
… downgrade aiosqlite due to aiohttp-client-cache
  • Loading branch information
netomi committed May 28, 2024
1 parent 943e843 commit f0c6800
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 170 deletions.
16 changes: 8 additions & 8 deletions DEPENDENCIES
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pypi/pypi/-/aiohttp/3.9.5
pypi/pypi/-/aiohttp-client-cache/0.11.0
pypi/pypi/-/aiohttp-client-cache/0.11.0
pypi/pypi/-/aiosignal/1.3.1
pypi/pypi/-/aiosqlite/0.20.0
pypi/pypi/-/aiosqlite/0.19.0
pypi/pypi/-/annotated-types/0.7.0
pypi/pypi/-/anyio/4.3.0
pypi/pypi/-/anyio/4.4.0
pypi/pypi/-/ariadne/0.22
pypi/pypi/-/async-timeout/4.0.3
pypi/pypi/-/attrs/23.2.0
Expand All @@ -32,7 +32,7 @@ pypi/pypi/-/greenlet/3.0.3
pypi/pypi/-/h11/0.14.0
pypi/pypi/-/h2/4.1.0
pypi/pypi/-/hpack/4.0.0
pypi/pypi/-/hypercorn/0.16.0
pypi/pypi/-/hypercorn/0.17.2
pypi/pypi/-/hyperframe/6.0.1
pypi/pypi/-/idna/3.7
pypi/pypi/-/importlib-resources/5.13.0
Expand All @@ -50,7 +50,7 @@ pypi/pypi/-/mintotp/0.3.0
pypi/pypi/-/mkdocs/1.6.0
pypi/pypi/-/mkdocs-exclude/1.0.2
pypi/pypi/-/mkdocs-get-deps/0.2.0
pypi/pypi/-/mkdocs-material/9.5.24
pypi/pypi/-/mkdocs-material/9.5.25
pypi/pypi/-/mkdocs-material-extensions/1.3.1
pypi/pypi/-/motor/3.4.0
pypi/pypi/-/multidict/6.0.5
Expand All @@ -62,8 +62,8 @@ pypi/pypi/-/platformdirs/4.2.2
pypi/pypi/-/playwright/1.44.0
pypi/pypi/-/priority/2.0.0
pypi/pypi/-/pycparser/2.22
pypi/pypi/-/pydantic/2.7.1
pypi/pypi/-/pydantic-core/2.18.2
pypi/pypi/-/pydantic/2.7.2
pypi/pypi/-/pydantic-core/2.18.3
pypi/pypi/-/pyee/11.1.0
pypi/pypi/-/pygments/2.18.0
pypi/pypi/-/pymdown-extensions/10.8.1
Expand All @@ -89,10 +89,10 @@ pypi/pypi/-/sniffio/1.3.1
pypi/pypi/-/starlette/0.37.2
pypi/pypi/-/taskgroup/0.0.0a4
pypi/pypi/-/tomli/2.0.1
pypi/pypi/-/typing-extensions/4.11.0
pypi/pypi/-/typing-extensions/4.12.0
pypi/pypi/-/url-normalize/1.4.3
pypi/pypi/-/urllib3/2.2.1
pypi/pypi/-/watchdog/4.0.0
pypi/pypi/-/watchdog/4.0.1
pypi/pypi/-/werkzeug/3.0.3
pypi/pypi/-/wsproto/1.2.0
pypi/pypi/-/yarl/1.9.4
6 changes: 1 addition & 5 deletions otterdog/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
import os
from sys import exit

import hypercorn
from decouple import config # type: ignore

from otterdog.webapp import create_app
from otterdog.webapp.config import config_dict
from otterdog.webapp.utils import SaneLogger, get_temporary_base_directory
from otterdog.webapp.utils import get_temporary_base_directory

# WARNING: Don't run with debug turned on in production!
DEBUG: bool = config("DEBUG", default=True, cast=bool)
Expand All @@ -30,9 +29,6 @@

app = create_app(app_config) # type: ignore

# patch logger_class used by hypercorn to avoid duplicate access log entries
hypercorn.config.Config.logger_class = SaneLogger

logging.basicConfig(
format="[%(asctime)s.%(msecs)03d ] [%(process)d] [%(levelname)s] %(message)s",
level=logging.INFO,
Expand Down
13 changes: 0 additions & 13 deletions otterdog/webapp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from logging import getLogger
from typing import cast

from hypercorn.logging import Logger as HypercornLogger
from hypercorn.typing import ResponseSummary, WWWScope
from quart import Quart, current_app
from quart_redis import get_redis # type: ignore

Expand Down Expand Up @@ -199,17 +197,6 @@ def escape_for_github(text: str) -> str:
return "\n".join(output)


class SaneLogger(HypercornLogger):
"""
A custom logger to prevent duplicate access log entries:
https://github.com/pgjones/hypercorn/issues/158
"""

async def access(self, request: WWWScope, response: ResponseSummary, request_time: float) -> None:
if response is not None:
await super().access(request, response, request_time)


def current_utc_time() -> datetime:
if sys.version_info < (3, 12):
return datetime.utcnow()
Expand Down
Loading

0 comments on commit f0c6800

Please sign in to comment.