diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/repo/RepoManager.kt | 12 |
1 files 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() |