Skip to content

Commit

Permalink
Add unsaved datetime import fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lahtinep committed Apr 22, 2024
1 parent be3bb77 commit bf2863b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions posttroll/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@

"""Simple library to subscribe to messages."""

from time import sleep
import datetime as dt
import logging
import time
from datetime import datetime, timedelta
from time import sleep
from threading import Lock
from urllib.parse import urlsplit

Expand Down Expand Up @@ -311,8 +311,8 @@ def start(self):
"""Start the subscriber."""
def _get_addr_loop(service, timeout):
"""Try to get the address of *service* until for *timeout* seconds."""
then = datetime.now() + timedelta(seconds=timeout)
while datetime.now() < then:
then = dt.datetime.now() + dt.timedelta(seconds=timeout)
while dt.datetime.now() < then:
addrs = get_pub_address(service, nameserver=self._nameserver)
if addrs:
return [addr["URI"] for addr in addrs]
Expand Down

0 comments on commit bf2863b

Please sign in to comment.