Skip to content

Commit 4e7eebd

Browse files
committed
fixed failing tests
1 parent 7c262a0 commit 4e7eebd

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ellar_throttler/throttler_guard.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,10 @@ def get_request_response(
6060
return connection_host.get_client(), connection_host.get_response()
6161

6262
def get_tracker(self, connection: HTTPConnection) -> str:
63-
assert connection.client
64-
return connection.client.host
63+
if connection.client:
64+
return connection.client.host
65+
66+
return t.cast(str, connection.scope["server"][0])
6567

6668
def generate_key(self, context: IExecutionContext, suffix: str) -> str:
6769
prefix = f"{get_name(context.get_class())}-{get_name(context.get_handler())}"

0 commit comments

Comments
 (0)