Skip to content

Commit

Permalink
✨ Don't shutdown on ledger error (#13)
Browse files Browse the repository at this point in the history
Signed-off-by: ff137 <[email protected]>
  • Loading branch information
ff137 committed Jan 29, 2025
1 parent dabf61b commit eb06de8
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions acapy_agent/core/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,24 +737,24 @@ def inbound_message_router(
lambda completed: self.dispatch_complete(message, completed),
)
except (LedgerConfigError, LedgerTransactionError) as e:
LOGGER.error("Shutdown on ledger error %s", str(e))
if self.admin_server:
self.admin_server.notify_fatal_error()
raise
LOGGER.warning("AVOIDED shutdown on ledger error %s", str(e))
# if self.admin_server:
# self.admin_server.notify_fatal_error()
# raise
pass

def dispatch_complete(self, message: InboundMessage, completed: CompletedTask):
"""Handle completion of message dispatch."""
if completed.exc_info:
exc_class, exc, _ = completed.exc_info
if isinstance(exc, (LedgerConfigError, LedgerTransactionError)):
LOGGER.fatal(
"%shutdown on ledger error %s",
"S" if self.admin_server else "No admin server to s",
LOGGER.warning(
"AVOIDED shutdown on ledger error %s",
str(exc),
exc_info=completed.exc_info,
)
if self.admin_server:
self.admin_server.notify_fatal_error()
# if self.admin_server:
# self.admin_server.notify_fatal_error()
elif isinstance(exc, (ProfileError, StorageNotFoundError)):
LOGGER.warning(
"Storage error occurred in message handler: %s: %s",
Expand Down Expand Up @@ -838,10 +838,10 @@ def handle_not_returned(self, profile: Profile, outbound: OutboundMessage):
try:
self.dispatcher.run_task(self.queue_outbound(profile, outbound))
except (LedgerConfigError, LedgerTransactionError) as e:
LOGGER.error("Shutdown on ledger error %s", str(e))
if self.admin_server:
self.admin_server.notify_fatal_error()
raise
LOGGER.warning("AVOIDED shutdown on ledger error %s", str(e))
# if self.admin_server:
# self.admin_server.notify_fatal_error()
# raise

async def queue_outbound(
self,
Expand Down Expand Up @@ -869,10 +869,10 @@ async def queue_outbound(
LOGGER.exception("Error preparing outbound message for transmission")
return OutboundSendStatus.UNDELIVERABLE
except (LedgerConfigError, LedgerTransactionError) as e:
LOGGER.error("Shutdown on ledger error %s", str(e))
if self.admin_server:
self.admin_server.notify_fatal_error()
raise
LOGGER.warning("AVOIDED shutdown on ledger error %s", str(e))
# if self.admin_server:
# self.admin_server.notify_fatal_error()
# raise
del conn_mgr
# Find oob/connectionless target we can send the message to
elif not has_target and outbound.reply_thread_id:
Expand Down

0 comments on commit eb06de8

Please sign in to comment.