Skip to content

Commit 57f6071

Browse files
committed
refactor(follower): switch to generator expression for changes iterator
1 parent 1407550 commit 57f6071

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ibmcloudant/features/changes_follower.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ def __next__(self):
157157
raise StopIteration from exc
158158
if isinstance(data, Exception):
159159
raise data from None
160-
self._changes_iter = iter(data)
160+
self._changes_iter = iter(
161+
(ChangesResultItem.from_dict(item) for item in data)
162+
)
161163
self._buffer.task_done()
162164

163165
def _request_callback(self):
@@ -178,9 +180,7 @@ def _request_callback(self):
178180
self._buffer.join()
179181
if self._stop.is_set():
180182
raise StopIteration
181-
self._buffer.put(
182-
[ChangesResultItem.from_dict(item) for item in results]
183-
)
183+
self._buffer.put(results)
184184
except Exception as e:
185185
self.logger.debug(f'Exception getting changes {e}')
186186
if (

0 commit comments

Comments
 (0)