Allow REFLEX_COMPILE_PROCESSES=0 to trigger multiprocessing with auto workers
This commit is contained in:
parent
5600bc5a30
commit
51bf447eb7
@ -860,8 +860,9 @@ class App(Base):
|
|||||||
# Use a forking process pool, if possible. Much faster, especially for large sites.
|
# Use a forking process pool, if possible. Much faster, especially for large sites.
|
||||||
# Fallback to ThreadPoolExecutor as something that will always work.
|
# Fallback to ThreadPoolExecutor as something that will always work.
|
||||||
executor = None
|
executor = None
|
||||||
if platform.system() in ("Linux", "Darwin") and os.environ.get(
|
if (
|
||||||
"REFLEX_COMPILE_PROCESSES"
|
platform.system() in ("Linux", "Darwin")
|
||||||
|
and os.environ.get("REFLEX_COMPILE_PROCESSES") is not None
|
||||||
):
|
):
|
||||||
executor = concurrent.futures.ProcessPoolExecutor(
|
executor = concurrent.futures.ProcessPoolExecutor(
|
||||||
max_workers=int(os.environ.get("REFLEX_COMPILE_PROCESSES", 0)) or None,
|
max_workers=int(os.environ.get("REFLEX_COMPILE_PROCESSES", 0)) or None,
|
||||||
|
Loading…
Reference in New Issue
Block a user