Skip to content

Commit

Permalink
feat: resolve method back to async
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurD1 committed Nov 1, 2024
1 parent 1064f97 commit bd98d86
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion harp/asgi/kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async def _resolve_http_controller(self, request: HttpRequest):
:param request:
:return:
"""
controller = self.resolver.resolve(request)
controller = await self.resolver.resolve(request)
if not controller:
raise RuntimeError("Unable to find request controller using resolver.")

Expand Down
4 changes: 2 additions & 2 deletions harp/controllers/resolvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DefaultControllerResolver(IControllerResolver):
def __init__(self, *, default_controller=None):
self.default_controller = default_controller or not_found_controller

def resolve(self, request: HttpRequest):
async def resolve(self, request: HttpRequest):
return self.default_controller


Expand Down Expand Up @@ -80,7 +80,7 @@ def add_controller(self, port: int, controller: IAsyncController):
raise RuntimeError(f"Port «{port}» already in use.")
self._ports[port] = controller

def resolve(self, request: HttpRequest):
async def resolve(self, request: HttpRequest):
return self._ports.get(request.server_port, self.default_controller)

def resolve_from_endpoint(self, endpoint: str):
Expand Down
2 changes: 1 addition & 1 deletion harp/controllers/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class IControllerResolver(Protocol):
def resolve(self, request: HttpRequest): ...
async def resolve(self, request: HttpRequest): ...


class IAsyncController(Protocol):
Expand Down

0 comments on commit bd98d86

Please sign in to comment.