|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
import asyncio
|
|
|
import inspect
|
|
|
+from multiprocessing.pool import ThreadPool
|
|
|
from typing import (
|
|
|
Any,
|
|
|
AsyncIterator,
|
|
@@ -454,17 +455,22 @@ class App(Base):
|
|
|
|
|
|
# Compile the pages.
|
|
|
custom_components = set()
|
|
|
+ thread_pool = ThreadPool()
|
|
|
for route, component in self.pages.items():
|
|
|
component.add_style(self.style)
|
|
|
- compiler.compile_page(
|
|
|
- route,
|
|
|
- component,
|
|
|
- self.state,
|
|
|
- self.connect_error_component,
|
|
|
+ thread_pool.apply_async(
|
|
|
+ compiler.compile_page,
|
|
|
+ args=(
|
|
|
+ route,
|
|
|
+ component,
|
|
|
+ self.state,
|
|
|
+ self.connect_error_component,
|
|
|
+ ),
|
|
|
)
|
|
|
-
|
|
|
# Add the custom components from the page to the set.
|
|
|
custom_components |= component.get_custom_components()
|
|
|
+ thread_pool.close()
|
|
|
+ thread_pool.join()
|
|
|
|
|
|
# Compile the custom components.
|
|
|
compiler.compile_components(custom_components)
|