Skip to content

Commit

Permalink
client_async: fix timeout calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
geaaru committed Nov 1, 2019
1 parent effe19c commit fbf480e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyrad/client_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def __timeout_handler__(self):
for id, req in self.pending_requests.items():

now = datetime.now()
secs = (req['sent_date'] - now).seconds
secs = (now - req['sent_date']).seconds
if secs > self.timeout:
if req['retries'] == self.retries:
self.logger.debug(
Expand All @@ -72,10 +72,11 @@ async def __timeout_handler__(self):
req['retries'] += 1
self.retries_counter += 1
self.logger.debug(
'[%s:%d:%d] For request %d execute retry %d.' % (
'[%s:%d:%d] For request %d reached %s secs. %s' % (
self.server, self.port,
socket.getsockname()[1] if socket else '',
id, req['retries']
id, secs,
'I execute retry %d.' % req['retries']
)
)

Expand Down

0 comments on commit fbf480e

Please sign in to comment.