From 86de2615132ec2f08ab172a969afc2dc93fb3503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linnea=20Gr=C3=A4f?= Date: Mon, 7 Jul 2025 16:26:12 +0200 Subject: [PATCH] fix(test): avoid coroutines in tests --- src/main/kotlin/repo/RepoManager.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/repo/RepoManager.kt b/src/main/kotlin/repo/RepoManager.kt index f06e33e..c3d1c52 100644 --- a/src/main/kotlin/repo/RepoManager.kt +++ b/src/main/kotlin/repo/RepoManager.kt @@ -8,7 +8,6 @@ import io.github.moulberry.repo.data.Rarity import java.nio.file.Path import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import net.minecraft.client.MinecraftClient @@ -139,12 +138,17 @@ object RepoManager { fun reloadForTest(from: Path) { neuRepo = makeNEURepository(from) - GlobalScope.launch { - reload() + reloadSync() + } + + + suspend fun reload() { + withContext(Dispatchers.IO) { + reloadSync() } } - suspend fun reload() = withContext(Dispatchers.Default) { + fun reloadSync() { try { logger.info("Repo reload started.") neuRepo.reload()