Skip to content

Commit

Permalink
Log HTTP errors & retry (on next event) instead of re-raising
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Apr 17, 2024
1 parent 0e1b6b1 commit 04eefc6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/charms/opensearch/v0/opensearch_locking.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ def acquired(self) -> bool: # noqa: C901
# Index already created
pass
else:
raise
logger.exception("Error creating OpenSearch lock index")
return False
# Attempt to create document id 0
try:
self._opensearch.request(
Expand All @@ -212,7 +213,8 @@ def acquired(self) -> bool: # noqa: C901
)
return False
else:
raise
logger.exception("Error creating OpenSearch lock document")
return False
# Lock acquired
# Release peer databag lock, if any
logger.debug("[Node lock] Acquired via opensearch")
Expand Down

0 comments on commit 04eefc6

Please sign in to comment.