This commit is contained in:
2023-10-21 11:45:29 -04:00
parent 449fae8e22
commit 8f46a3e78a

View File

@@ -92,6 +92,12 @@ class Obs(private val q:BlockingQueue<Op>): AutoCloseable {
private fun onReady() {
log.info("ready")
ready.set(true)
// The docs say that you are only supposed to send requests from the [onReady] handler,
// but you cannot block the [onReady] handler.
// (If you block the [onReady] handler other handlers are not called. [onDisconnect] is not called so you
// cannot reconnect if OBS is restarted.)
// This would be fine if `onReady` was called after each response, but it is not.
// So we keep track of if it is ready, and make requests from another thread ([opThread]).
}
private val opThread = thread(name="obs-op", isDaemon=false, start=true) {