diff --git a/libraries/apollo-websocket-network-transport-incubating/src/commonMain/kotlin/com/apollographql/apollo3/network/ws/incubating/WebSocketHolder.kt b/libraries/apollo-websocket-network-transport-incubating/src/commonMain/kotlin/com/apollographql/apollo3/network/ws/incubating/WebSocketHolder.kt index c0f906c30e4..db58b271220 100644 --- a/libraries/apollo-websocket-network-transport-incubating/src/commonMain/kotlin/com/apollographql/apollo3/network/ws/incubating/WebSocketHolder.kt +++ b/libraries/apollo-websocket-network-transport-incubating/src/commonMain/kotlin/com/apollographql/apollo3/network/ws/incubating/WebSocketHolder.kt @@ -27,6 +27,10 @@ internal class WebSocketHolder( private var lock = reentrantLock() init { + // Make sure we do not busy loop + check(idleTimeoutMillis > 0) { + "Apollo: 'idleTimeoutMillis' must be > 0" + } triggerCleanup(timeoutMillis = idleTimeoutMillis) }