-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
wasmClientDisconnect takes a function that's called when the disconnect has concluded, but lnc-web doesn't use it.
As a result, consumers end up needing to do something like this:
lnc.disconnect()
logger.info('disconnecting after:', `payment_hash=${hash}`)
// wait for lnc to disconnect before releasing the mutex
await new Promise((resolve, reject) => {
let counter = 0
const interval = setInterval(() => {
if (lnc.isConnected) {
if (counter++ > 100) {
logger.error('failed to disconnect from lnc')
clearInterval(interval)
reject(new Error('failed to disconnect from lnc'))
}
return
}
clearInterval(interval)
resolve()
})
}, 50)Happy to create a PR myself to the effect of
async disconnect() {
return await new Promise(resolve => this.wasm.wasmClientDisconnect(resolve);
}... if it makes sense
Metadata
Metadata
Assignees
Labels
No labels