diff --git a/platform/projectModel-api/src/org/jetbrains/concurrency/AsyncPromise.kt b/platform/projectModel-api/src/org/jetbrains/concurrency/AsyncPromise.kt index a32c4f8ed4b8..b6312da03294 100644 --- a/platform/projectModel-api/src/org/jetbrains/concurrency/AsyncPromise.kt +++ b/platform/projectModel-api/src/org/jetbrains/concurrency/AsyncPromise.kt @@ -182,10 +182,12 @@ open class AsyncPromise : Promise, Getter { } override fun blockingGet(timeout: Int, timeUnit: TimeUnit): T? { - val latch = CountDownLatch(1) - processed { latch.countDown() } - if (!latch.await(timeout.toLong(), timeUnit)) { - throw TimeoutException() + if (isPending) { + val latch = CountDownLatch(1) + processed { latch.countDown() } + if (!latch.await(timeout.toLong(), timeUnit)) { + throw TimeoutException() + } } @Suppress("UNCHECKED_CAST")