Skip to content

Commit

Permalink
iso dt update in signaling
Browse files Browse the repository at this point in the history
  • Loading branch information
rodolfomiranda committed Jul 31, 2024
1 parent 0c5daaa commit ace0eb3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/keri/app/signaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def signal(attrs, topic, ckey=None, dt=None):
Notice: Notice instance
"""
dt = dt if dt is not None else datetime.datetime.now().isoformat()
dt = dt if dt is not None else helping.nowIso8601()

if hasattr(dt, "isoformat"):
dt = dt.isoformat()
Expand Down Expand Up @@ -117,7 +117,7 @@ def push(self, attrs, topic, ckey=None, dt=None):
Returns:
"""
dt = dt if dt is not None else datetime.datetime.now()
dt = dt if dt is not None else helping.nowIso8601()
sig = signal(attrs=attrs, topic=topic, ckey=ckey, dt=dt)

if sig.ckey is not None:
Expand Down Expand Up @@ -146,7 +146,7 @@ def expireDo(self, tymth=None, tock=0.0):
_ = (yield self.tock)

while True: # loop checking for expired messages
now = datetime.datetime.now()
now = helping.nowUTC()
toRemove = []
for sig in self.signals:
if now - helping.fromIso8601(sig.dt) > self.SignalTimeout: # Expire messages that are too old
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_notifying.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_notifier(mockHelpingNowUTC):
assert notifier.rem(note.rid) is True
assert notifier.getNotes() == []

dt = datetime.datetime.now()
dt = helping.nowIso8601()
assert notifier.add(attrs=dict(a=1)) is True
assert notifier.add(attrs=dict(a=2)) is True
assert notifier.add(attrs=dict(a=3)) is True
Expand Down
2 changes: 1 addition & 1 deletion tests/app/test_signaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_signaler():
signaler.push(attrs=dict(a=1), topic="/m")
signaler.push(attrs=dict(a=2), topic="/m", ckey="abc")
signaler.push(attrs=dict(a=3), topic="/m")
now = datetime.datetime.now() - datetime.timedelta(minutes=11)
now = helping.nowUTC() - datetime.timedelta(minutes=11)
signaler.push(attrs=dict(a=4), topic="/m", ckey="abc", dt=now)

assert len(signaler.signals) == 3
Expand Down

0 comments on commit ace0eb3

Please sign in to comment.