Skip to content

Commit

Permalink
session.py: don't process a request if closing
Browse files Browse the repository at this point in the history
  • Loading branch information
Neil Booth committed Apr 25, 2019
1 parent fbbc2c1 commit 707c989
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aiorpcx/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def _recalc_concurrency(self):
self._outgoing_concurrency.set_target(target)

async def _receive_messages(self):
while not self.is_closing():
while True:
try:
message = await self.framer.receive_message()
except MemoryError as e:
Expand Down Expand Up @@ -559,6 +559,8 @@ async def _throttled_request(self, request):
timeout = self.processing_timeout
async with timeout_after(timeout):
async with self._incoming_concurrency:
if self.is_closing():
return
if self._cost_fraction:
await sleep(self._cost_fraction * self.cost_sleep)
result = await self.handle_request(request)
Expand Down

0 comments on commit 707c989

Please sign in to comment.