From 464f3392406511dbaf3e99adf569f9fb6065f585 Mon Sep 17 00:00:00 2001 From: JFronny Date: Sun, 12 May 2024 17:36:39 +0200 Subject: [PATCH] fix: maybe don't block the IO thread for seconds at a time --- src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt b/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt index 4f9132f..ef674f1 100644 --- a/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt +++ b/src/main/kotlin/io/gitlab/jfronny/sdom/SDom.kt @@ -19,6 +19,7 @@ import io.ktor.client.request.* import io.ktor.http.* import io.ktor.serialization.kotlinx.json.* import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.launch @@ -220,7 +221,7 @@ object SDom { result.forEach { resultFlow.emit(Result.success(it)) } break } else { - Thread.sleep(1000) + delay(1000) } } while (true) } catch (e: Exception) {