Better exception handling for Elastic adapter#164
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #164 +/- ##
==========================================
- Coverage 82.94% 82.86% -0.08%
==========================================
Files 34 34
Lines 3554 3561 +7
==========================================
+ Hits 2948 2951 +3
- Misses 606 610 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
yunzheng
left a comment
There was a problem hiding this comment.
next to the inline comment, can you also move the following code block:
self.exception: Exception | None = None
threading.excepthook = self.excepthookto before self.es = elasticsearch.Elasticsearch().
This ensures that if it fails during instantiating ElasticSearch(), that self.exception is available and does not cause another exception during close().
|
We added a simple pure python progress bar for the elastic writer in 06cfa15. |
On the topic of progress bars, I thought of a mechanism recently that will generically allow any I plan to write down these concepts in a few issues next week. |
I ❤️ progress bars. To comment on this from the |
Co-authored-by: Yun Zheng Hu <hu@fox-it.com>
This PR fixes two issues with the Elastic adapter. Currently the Elastic adapter fails silently - as in it does not break but continues - when a record is not inserted in the index. We make sure to raise a
ValueErrorinstead so thethreading.excepthookcatches the error and stops the elastic writer.The second issue we fix here is we make sure both reader and writer threads crash when
self.exceptionis filled. This prevents a hanging reader thread if the writer thread fails.