Fix date empty when getting difference

This commit is contained in:
Lonami Exo 2023-09-13 17:35:15 +02:00
parent 7ce0b2f940
commit 7325718f0e
2 changed files with 6 additions and 5 deletions

View File

@ -175,7 +175,7 @@ class MessageBox:
map: dict = _sentinel, # entry -> state map: dict = _sentinel, # entry -> state
# Additional fields beyond PTS needed by `ENTRY_ACCOUNT`. # Additional fields beyond PTS needed by `ENTRY_ACCOUNT`.
date: datetime.datetime = epoch(), date: datetime.datetime = epoch() + datetime.timedelta(seconds=1),
seq: int = NO_SEQ, seq: int = NO_SEQ,
# Holds the entry with the closest deadline (optimization to avoid recalculating the minimum deadline). # Holds the entry with the closest deadline (optimization to avoid recalculating the minimum deadline).
@ -478,6 +478,7 @@ class MessageBox:
if any_pts_applied[0]: if any_pts_applied[0]:
if __debug__: if __debug__:
self._trace('Updating seq as local pts was updated too') self._trace('Updating seq as local pts was updated too')
if date != epoch():
self.date = date self.date = date
if seq != NO_SEQ: if seq != NO_SEQ:
self.seq = seq self.seq = seq
@ -689,7 +690,7 @@ class MessageBox:
updates=diff.other_updates, updates=diff.other_updates,
users=diff.users, users=diff.users,
chats=diff.chats, chats=diff.chats,
date=epoch() + datetime.timedelta(seconds=1), date=epoch(),
seq=NO_SEQ, # this way date is not used seq=NO_SEQ, # this way date is not used
), chat_hashes, updates) ), chat_hashes, updates)
@ -798,7 +799,7 @@ class MessageBox:
updates=diff.other_updates, updates=diff.other_updates,
users=diff.users, users=diff.users,
chats=diff.chats, chats=diff.chats,
date=epoch() + datetime.timedelta(seconds=1), date=epoch(),
seq=NO_SEQ, # this way date is not used seq=NO_SEQ, # this way date is not used
), chat_hashes, updates) ), chat_hashes, updates)

View File

@ -1,3 +1,3 @@
# Versions should comply with PEP440. # Versions should comply with PEP440.
# This line is parsed in setup.py: # This line is parsed in setup.py:
__version__ = '1.30.2' __version__ = '1.30.3'