forked from LBRYCommunity/lbry-sdk
Revise exception handling.
This commit is contained in:
parent
20b1865879
commit
c3f5dd780e
1 changed files with 6 additions and 4 deletions
|
@ -37,8 +37,10 @@ class WalletServerPayer:
|
||||||
delay = max(self.payment_period / 24, 10)
|
delay = max(self.payment_period / 24, 10)
|
||||||
log.warning("Payement failed. Will retry after %g seconds.", delay)
|
log.warning("Payement failed. Will retry after %g seconds.", delay)
|
||||||
asyncio.sleep(delay)
|
asyncio.sleep(delay)
|
||||||
except Exception:
|
except BaseException as e:
|
||||||
log.exception("Unexpected exception. Payment task exiting early.")
|
if not isinstance(e, asyncio.CancelledError):
|
||||||
|
log.exception("Unexpected exception. Payment task exiting early.")
|
||||||
|
self.running = False
|
||||||
raise
|
raise
|
||||||
|
|
||||||
async def _pay(self):
|
async def _pay(self):
|
||||||
|
@ -78,8 +80,8 @@ class WalletServerPayer:
|
||||||
self.wallet.get_accounts_or_all(None),
|
self.wallet.get_accounts_or_all(None),
|
||||||
self.wallet.get_account_or_default(None)
|
self.wallet.get_account_or_default(None)
|
||||||
)
|
)
|
||||||
except InsufficientFundsError as e:
|
except InsufficientFundsError:
|
||||||
self._on_payment_controller.add_error(e)
|
self._on_payment_controller.add_error(InsufficientFundsError())
|
||||||
continue
|
continue
|
||||||
|
|
||||||
await self.ledger.broadcast_or_release(tx, blocking=True)
|
await self.ledger.broadcast_or_release(tx, blocking=True)
|
||||||
|
|
Loading…
Reference in a new issue