avoid comments endless loop - check if query_response is always the same (#1347)

This commit is contained in:
JeremyKj87 2021-11-27 15:47:32 +01:00 committed by GitHub
parent 470fc0d905
commit 815ba83d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -133,14 +133,15 @@ class NodeIterator(Iterator[T]):
return item return item
if self._data['page_info']['has_next_page']: if self._data['page_info']['has_next_page']:
query_response = self._query(self._data['page_info']['end_cursor']) query_response = self._query(self._data['page_info']['end_cursor'])
page_index, data = self._page_index, self._data if self._data['edges'] != query_response['edges']:
try: page_index, data = self._page_index, self._data
self._page_index = 0 try:
self._data = query_response self._page_index = 0
except KeyboardInterrupt: self._data = query_response
self._page_index, self._data = page_index, data except KeyboardInterrupt:
raise self._page_index, self._data = page_index, data
return self.__next__() raise
return self.__next__()
raise StopIteration() raise StopIteration()
@property @property