Skip to content

Commit

Permalink
Add capture exception for CreateLogStream, to avoid flush stuck when …
Browse files Browse the repository at this point in the history
…CreateLogStream throttle. (#192)
  • Loading branch information
lyso authored Mar 10, 2024
1 parent f8e498e commit 04edbfe
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions watchtower/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ def _submit_batch(self, batch, log_stream_name, max_retries=5):
# at this point, the first write to the new stream
# should not contain a sequence token at all.
kwargs.pop("sequenceToken", None)
except Exception as e2:
# Make sure exception in CreateLogStream not exit
# this thread but conitnue to retry
warnings.warn(
"Failed to create log stream {} when delivering log: {}".format(log_stream_name, e2),
WatchtowerWarning,
)
finally:
self.creating_log_stream = False
else:
Expand Down

0 comments on commit 04edbfe

Please sign in to comment.