remove unused code
This commit is contained in:
parent
c0d723e63b
commit
583eec7286
@ -883,7 +883,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
|
|||||||
progress.start()
|
progress.start()
|
||||||
task = progress.add_task(
|
task = progress.add_task(
|
||||||
f"[{get_compilation_time()}] Compiling:",
|
f"[{get_compilation_time()}] Compiling:",
|
||||||
total=len(self.unevaluated_pages)
|
total=len(self.pages)
|
||||||
+ fixed_pages_within_executor
|
+ fixed_pages_within_executor
|
||||||
+ adhoc_steps_without_executor,
|
+ adhoc_steps_without_executor,
|
||||||
)
|
)
|
||||||
@ -948,38 +948,16 @@ class App(MiddlewareMixin, LifespanMixin, Base):
|
|||||||
for route, component in zip(self.pages, page_components):
|
for route, component in zip(self.pages, page_components):
|
||||||
ExecutorSafeFunctions.COMPONENTS[route] = component
|
ExecutorSafeFunctions.COMPONENTS[route] = component
|
||||||
|
|
||||||
for route, page in self.unevaluated_pages.items():
|
|
||||||
if route in self.pages:
|
|
||||||
continue
|
|
||||||
|
|
||||||
ExecutorSafeFunctions.UNCOMPILED_PAGES[route] = page
|
|
||||||
|
|
||||||
ExecutorSafeFunctions.STATE = self.state
|
ExecutorSafeFunctions.STATE = self.state
|
||||||
|
|
||||||
pages_results = []
|
|
||||||
|
|
||||||
with executor:
|
with executor:
|
||||||
result_futures = []
|
result_futures = []
|
||||||
pages_futures = []
|
|
||||||
|
|
||||||
def _submit_work(fn, *args, **kwargs):
|
def _submit_work(fn, *args, **kwargs):
|
||||||
f = executor.submit(fn, *args, **kwargs)
|
f = executor.submit(fn, *args, **kwargs)
|
||||||
# f = executor.apipe(fn, *args, **kwargs)
|
# f = executor.apipe(fn, *args, **kwargs)
|
||||||
result_futures.append(f)
|
result_futures.append(f)
|
||||||
|
|
||||||
# Compile all page components.
|
|
||||||
for route in self.unevaluated_pages:
|
|
||||||
if route in self.pages:
|
|
||||||
continue
|
|
||||||
|
|
||||||
f = executor.submit(
|
|
||||||
ExecutorSafeFunctions.compile_unevaluated_page,
|
|
||||||
route,
|
|
||||||
self.style,
|
|
||||||
self.theme,
|
|
||||||
)
|
|
||||||
pages_futures.append(f)
|
|
||||||
|
|
||||||
# Compile the pre-compiled pages.
|
# Compile the pre-compiled pages.
|
||||||
for route in self.pages:
|
for route in self.pages:
|
||||||
_submit_work(
|
_submit_work(
|
||||||
@ -1007,16 +985,7 @@ class App(MiddlewareMixin, LifespanMixin, Base):
|
|||||||
compile_results.append(future.result())
|
compile_results.append(future.result())
|
||||||
progress.advance(task)
|
progress.advance(task)
|
||||||
|
|
||||||
for future in concurrent.futures.as_completed(pages_futures):
|
for component in self.pages.values():
|
||||||
pages_results.append(future.result())
|
|
||||||
progress.advance(task)
|
|
||||||
|
|
||||||
for route, component, compiled_page in pages_results:
|
|
||||||
self._check_routes_conflict(route)
|
|
||||||
self.pages[route] = component
|
|
||||||
compile_results.append(compiled_page)
|
|
||||||
|
|
||||||
for _, component in self.pages.items():
|
|
||||||
# Add component._get_all_imports() to all_imports.
|
# Add component._get_all_imports() to all_imports.
|
||||||
all_imports.update(component._get_all_imports())
|
all_imports.update(component._get_all_imports())
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user