From 8f46a3e78a95bfd66ab53c5e1bd325d7a1c113e0 Mon Sep 17 00:00:00 2001 From: stephen Date: Sat, 21 Oct 2023 11:45:29 -0400 Subject: [PATCH] docs --- src/main/kotlin/net/eksb/obsdc/Obs.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/kotlin/net/eksb/obsdc/Obs.kt b/src/main/kotlin/net/eksb/obsdc/Obs.kt index 95788aa..73a9159 100644 --- a/src/main/kotlin/net/eksb/obsdc/Obs.kt +++ b/src/main/kotlin/net/eksb/obsdc/Obs.kt @@ -92,6 +92,12 @@ class Obs(private val q:BlockingQueue): 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) {