Fixes incorrect latest stamp when download is resumed (#1717)

This commit is contained in:
Eduardo Kalinowski 2022-09-07 16:01:48 -03:00 committed by GitHub
parent e97fd8a27c
commit 8debcbb7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 13 deletions

View File

@ -77,7 +77,7 @@ class NodeIterator(Iterator[T]):
query_variables: Optional[Dict[str, Any]] = None,
query_referer: Optional[str] = None,
first_data: Optional[Dict[str, Any]] = None,
is_first: Optional[Callable[[T], bool]] = None):
is_first: Optional[Callable[[T, Optional[T]], bool]] = None):
self._context = context
self._query_hash = query_hash
self._edge_extractor = edge_extractor
@ -131,7 +131,7 @@ class NodeIterator(Iterator[T]):
raise
item = self._node_wrapper(node)
if self._is_first is not None:
if self._is_first(item):
if self._is_first(item, self.first_item):
self._first_node = node
else:
if self._first_node is None:

View File

@ -1039,17 +1039,8 @@ class Profile:
)
@staticmethod
def _make_is_newest_checker() -> Callable[[Post], bool]:
newest_date: Optional[datetime] = None
def is_newest(p: Post) -> bool:
nonlocal newest_date
post_date = p.date_local
if newest_date is None or post_date > newest_date:
newest_date = post_date
return True
else:
return False
return is_newest
def _make_is_newest_checker() -> Callable[[Post, Optional[Post]], bool]:
return lambda post, first: first is None or post.date_local > first.date_local
def get_followers(self) -> NodeIterator['Profile']:
"""