mirror of
https://github.com/lnbits/lnbits.git
synced 2025-03-26 17:51:53 +01:00
Wallets: Catch errors during cleanup (#1829)
* jetz aba * catch RuntimeError
This commit is contained in:
parent
befb288900
commit
2d4c9f349b
@ -44,7 +44,10 @@ class EclairWallet(Wallet):
|
||||
self.client = httpx.AsyncClient(base_url=self.url, headers=self.auth)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
r = await self.client.post("/globalbalance", timeout=5)
|
||||
|
@ -32,7 +32,10 @@ class LNbitsWallet(Wallet):
|
||||
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.key)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
try:
|
||||
|
@ -69,7 +69,10 @@ class LndRestWallet(Wallet):
|
||||
)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
try:
|
||||
|
@ -35,7 +35,10 @@ class LNPayWallet(Wallet):
|
||||
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.auth)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
url = f"/wallet/{self.wallet_key}"
|
||||
|
@ -33,7 +33,10 @@ class LnTipsWallet(Wallet):
|
||||
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.auth)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
r = await self.client.get("/api/v1/balance", timeout=40)
|
||||
|
@ -37,7 +37,10 @@ class OpenNodeWallet(Wallet):
|
||||
self.client = httpx.AsyncClient(base_url=self.endpoint, headers=self.auth)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
async def status(self) -> StatusResponse:
|
||||
try:
|
||||
|
@ -37,7 +37,10 @@ class SparkWallet(Wallet):
|
||||
)
|
||||
|
||||
async def cleanup(self):
|
||||
await self.client.aclose()
|
||||
try:
|
||||
await self.client.aclose()
|
||||
except RuntimeError as e:
|
||||
logger.warning(f"Error closing wallet connection: {e}")
|
||||
|
||||
def __getattr__(self, key):
|
||||
async def call(*args, **kwargs):
|
||||
|
Loading…
x
Reference in New Issue
Block a user