mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-17 10:36:37 +00:00
Assert reset_deadline is not unnecessarily called
This commit is contained in:
parent
6f6b207866
commit
a38170d26a
@ -266,9 +266,8 @@ class MessageBox:
|
|||||||
#
|
#
|
||||||
# It also updates the next deadline time to reflect the new closest deadline.
|
# It also updates the next deadline time to reflect the new closest deadline.
|
||||||
def reset_deadline(self, entry, deadline):
|
def reset_deadline(self, entry, deadline):
|
||||||
if entry in self.map:
|
if entry not in self.map:
|
||||||
self.map[entry].deadline = deadline
|
raise RuntimeError('Called reset_deadline on an entry for which we do not have state')
|
||||||
# TODO figure out why not in map may happen
|
|
||||||
|
|
||||||
if self.next_deadline == entry:
|
if self.next_deadline == entry:
|
||||||
# If the updated deadline was the closest one, recalculate the new minimum.
|
# If the updated deadline was the closest one, recalculate the new minimum.
|
||||||
@ -464,6 +463,8 @@ class MessageBox:
|
|||||||
# the "no updates" period for that entry is reset.
|
# the "no updates" period for that entry is reset.
|
||||||
#
|
#
|
||||||
# Build the `HashSet` to avoid calling `reset_deadline` more than once for the same entry.
|
# Build the `HashSet` to avoid calling `reset_deadline` more than once for the same entry.
|
||||||
|
#
|
||||||
|
# By the time this method returns, self.map will have an entry for which we can reset its deadline.
|
||||||
if reset_deadline:
|
if reset_deadline:
|
||||||
self.reset_deadlines_for.add(pts.entry)
|
self.reset_deadlines_for.add(pts.entry)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user