Skip to content

Commit

Permalink
Properly handle min_age = None and max_age = None for MessageManager
Browse files Browse the repository at this point in the history
  • Loading branch information
horazont committed Feb 26, 2018
1 parent 87fc9e0 commit 3868a75
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jclib/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ def get_last_messages(
for i, message_uid in enumerate(reversed(state.messages)):
msg = self._in_memory_archive_data[message_uid]
ts = msg[0]
if max_count <= 0 and ts <= min_age:
if max_count <= 0 and (min_age is None or ts <= min_age):
self.logger.debug("at limit already and %r <= %r",
ts, min_age)
break
if ts < max_age:
if max_age is not None and ts < max_age:
self.logger.debug("too old: %r < %r",
ts, max_age)
break
Expand Down

0 comments on commit 3868a75

Please sign in to comment.