Skip to content

Commit ad7d921

Browse files
committed
refactor(follower): better logs for stopping iterator
1 parent b990ef5 commit ad7d921

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ibmcloudant/features/changes_follower.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ def _request_callback(self):
182182
[ChangesResultItem.from_dict(item) for item in results]
183183
)
184184
except Exception as e:
185-
self.logger.debug(f'Exception getting changes {e}')
185+
if type(e) is not StopIteration:
186+
self.logger.debug(f'Exception getting changes {e}')
186187
if (
187188
self._transient_suppression == _TransientErrorSuppression.NEVER
188189
or (
@@ -200,7 +201,10 @@ def _request_callback(self):
200201
type(e) is ApiException and e.status_code in [400, 401, 403, 404]
201202
or type(e) is StopIteration
202203
):
203-
self.logger.debug('Terminal error.')
204+
if type(e) is StopIteration:
205+
self.logger.debug('Iterator stopped.')
206+
else:
207+
self.logger.debug('Terminal error.')
204208
self._buffer.join()
205209
self._buffer.put(e)
206210
break

0 commit comments

Comments
 (0)