mirror of
https://github.com/aljazceru/breez-sdk-liquid.git
synced 2026-01-24 16:34:20 +01:00
Add shutdown signal (#238)
* Add shutdown signal handling Revert periodic sync interval change Revert keep-alive interval change CLI: Add disconnect command SDK: Add scaffolding for is_started, shutdown() Simplify instance init * Rebase on savage-async-ws branch * Avoid waiting when shutdown signal is received in the sync loop * Directly use shutdown signal in background threads * Acquire is_started lock at the very beginning of start() * Fix cargo clippy warnings * Update RN generator (kt): set bindingLiquidSdk to null on disconnect() * Update RN generator (swift): set bindingLiquidSdk to nil on disconnect() * Startup: only run foreground sync() if this could be the first run * Start a sync() in background, before regular sync() loop * Remove ensure_started check from start() * Add bindings for disconnect() * Remove foreground sync condition from startup * Simplify background sync loop
This commit is contained in:
@@ -254,4 +254,17 @@ class BreezLiquidSDKModule(reactContext: ReactApplicationContext) : ReactContext
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
fun disconnect(promise: Promise) {
|
||||
executor.execute {
|
||||
try {
|
||||
getBindingLiquidSdk().disconnect()
|
||||
bindingLiquidSdk = null
|
||||
promise.resolve(readableMapOf("status" to "ok"))
|
||||
} catch (e: Exception) {
|
||||
promise.reject(e.javaClass.simpleName.replace("Exception", "Error"), e.message, e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user