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) {