fix: remove closed websocket
This commit is contained in:
parent
e05b54468a
commit
b8fe674dd7
2 changed files with 16 additions and 9 deletions
|
|
@ -22,6 +22,7 @@ class NostrClient:
|
||||||
await self.send_req_queue.put(ValueError("Restarting NostrClient..."))
|
await self.send_req_queue.put(ValueError("Restarting NostrClient..."))
|
||||||
await self.recieve_event_queue.put(ValueError("Restarting NostrClient..."))
|
await self.recieve_event_queue.put(ValueError("Restarting NostrClient..."))
|
||||||
self.ws.close()
|
self.ws.close()
|
||||||
|
self.ws = None
|
||||||
|
|
||||||
async def connect_to_nostrclient_ws(
|
async def connect_to_nostrclient_ws(
|
||||||
self, on_open: Callable, on_message: Callable
|
self, on_open: Callable, on_message: Callable
|
||||||
|
|
@ -68,7 +69,7 @@ class NostrClient:
|
||||||
req = await self.send_req_queue.get()
|
req = await self.send_req_queue.get()
|
||||||
if isinstance(req, ValueError):
|
if isinstance(req, ValueError):
|
||||||
running = False
|
running = False
|
||||||
logger.warning("Nostr Client stopping")
|
logger.warning(str(req))
|
||||||
else:
|
else:
|
||||||
self.ws.send(json.dumps(req))
|
self.ws.send(json.dumps(req))
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
|
|
|
||||||
|
|
@ -138,15 +138,21 @@ const merchant = async () => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
restartNostrConnection: async function () {
|
restartNostrConnection: async function () {
|
||||||
try {
|
LNbits.utils
|
||||||
await LNbits.api.request(
|
.confirmDialog(
|
||||||
'PUT',
|
'Are you sure you want to reconnect to the nostrcient extension?'
|
||||||
'/nostrmarket/api/v1/restart',
|
|
||||||
this.g.user.wallets[0].adminkey
|
|
||||||
)
|
)
|
||||||
} catch (error) {
|
.onOk(async () => {
|
||||||
LNbits.utils.notifyApiError(error)
|
try {
|
||||||
}
|
await LNbits.api.request(
|
||||||
|
'PUT',
|
||||||
|
'/nostrmarket/api/v1/restart',
|
||||||
|
this.g.user.wallets[0].adminkey
|
||||||
|
)
|
||||||
|
} catch (error) {
|
||||||
|
LNbits.utils.notifyApiError(error)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: async function () {
|
created: async function () {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue