Skip to content

Commit

Permalink
chore: failure workaround no longer needed for babble 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jrriehl committed Jul 28, 2023
1 parent 940c8c6 commit 82b6db0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion src/uagents/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class AgentNetwork(Enum):
MAILBOX_POLL_INTERVAL_SECONDS = 1.0

WALLET_MESSAGING_POLL_INTERVAL_SECONDS = 2.0
WALLET_MESSAGING_MAX_CONSECUTIVE_FAILURES = 10

DEFAULT_ENVELOPE_TIMEOUT_SECONDS = 30

Expand Down
12 changes: 1 addition & 11 deletions src/uagents/wallet_messaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from uagents.config import (
WALLET_MESSAGING_POLL_INTERVAL_SECONDS,
WALLET_MESSAGING_MAX_CONSECUTIVE_FAILURES,
get_logger,
)
from uagents.context import Context, WalletMessageCallback
Expand Down Expand Up @@ -65,24 +64,15 @@ async def send(

async def poll_server(self):
self._logger.info("Connecting to wallet messaging server")
consecutive_failures = 0
while True:
try:
for msg in self._client.receive():
await self._message_queue.put(msg)
consecutive_failures = 0
except ( # pylint: disable=W0703
except (
HTTPError,
ConnectionError,
JSONDecodeError,
BaseException,
) as ex:
consecutive_failures += 1
if consecutive_failures > WALLET_MESSAGING_MAX_CONSECUTIVE_FAILURES:
self._logger.exception(
"Failed to retrieve wallet messages too many times. Shutting down now."
)
sys.exit(1)
self._logger.warning(
f"Failed to get messages from wallet messaging server: {ex}"
)
Expand Down

0 comments on commit 82b6db0

Please sign in to comment.