From df980fe67ba49b959163ae96c54711550368d153 Mon Sep 17 00:00:00 2001 From: Andrzej Ratajczak Date: Wed, 22 Apr 2020 10:07:06 +0200 Subject: Fix dispatcher --- .../src/main/kotlin/renderers/DefaultRenderer.kt | 23 +--------------------- .../src/main/kotlin/renderers/html/HtmlRenderer.kt | 4 ++-- 2 files changed, 3 insertions(+), 24 deletions(-) (limited to 'plugins/base/src/main') diff --git a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt index 1b187984..925767ce 100644 --- a/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/DefaultRenderer.kt @@ -142,34 +142,13 @@ abstract class DefaultRenderer( } } - // reimplement this as preprocessor - open fun renderPackageList(root: ContentPage) = - getPackageNamesAndPlatforms(root) - .keys - .joinToString("\n") - .also { - runBlocking { - outputWriter.write("${root.name}/package-list", it, "") - } - } - - open fun getPackageNamesAndPlatforms(root: PageNode): Map> = - root.children - .map { getPackageNamesAndPlatforms(it) } - .fold(emptyMap>()) { e, acc -> acc + e } + - if (root is PackagePageNode) { - mapOf(root.name to root.platforms()) - } else { - emptyMap() - } - override fun render(root: RootPageNode) { val newRoot = preprocessors.fold(root) { acc, t -> t(acc) } locationProvider = context.plugin().querySingle { locationProviderFactory }.getLocationProvider(newRoot) - runBlocking { + runBlocking(Dispatchers.Default) { renderPages(newRoot) } } diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt index 796d6483..205897a4 100644 --- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt +++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt @@ -285,8 +285,8 @@ open class HtmlRenderer( override fun render(root: RootPageNode) { super.render(root) - runBlocking { - launch(Dispatchers.IO) { + runBlocking(Dispatchers.Default) { + launch { outputWriter.write("scripts/pages", "var pages = [\n${pageList.joinToString(",\n")}\n]", ".js") } } -- cgit