perf: run all background build/merge/rsync subprocesses at nice 19
This commit is contained in:
@@ -51,6 +51,8 @@ def _job_finish(job_id: str) -> None:
|
|||||||
_rebuild_lock = threading.Lock()
|
_rebuild_lock = threading.Lock()
|
||||||
_site_rebuild_event = threading.Event()
|
_site_rebuild_event = threading.Event()
|
||||||
|
|
||||||
|
_low_priority = {"preexec_fn": lambda: os.nice(19)}
|
||||||
|
|
||||||
|
|
||||||
def _site_rebuild_worker() -> None:
|
def _site_rebuild_worker() -> None:
|
||||||
"""Single background thread: debounced Astro build + rsync after uploads.
|
"""Single background thread: debounced Astro build + rsync after uploads.
|
||||||
@@ -76,6 +78,7 @@ def _site_rebuild_worker() -> None:
|
|||||||
"--site-dir", _site_dir],
|
"--site-dir", _site_dir],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
**_low_priority,
|
||||||
)
|
)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
log.error("site-rebuild: build failed (rc=%d):\n%s\n%s",
|
log.error("site-rebuild: build failed (rc=%d):\n%s\n%s",
|
||||||
@@ -89,6 +92,7 @@ def _site_rebuild_worker() -> None:
|
|||||||
f"{_site_dir}/dist/", _webroot + "/"],
|
f"{_site_dir}/dist/", _webroot + "/"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
**_low_priority,
|
||||||
)
|
)
|
||||||
if rsync.returncode != 0:
|
if rsync.returncode != 0:
|
||||||
log.error("site-rebuild: rsync failed (rc=%d):\n%s\n%s",
|
log.error("site-rebuild: rsync failed (rc=%d):\n%s\n%s",
|
||||||
@@ -138,6 +142,7 @@ def _trigger_rebuild(handle: str) -> None:
|
|||||||
"--no-build"],
|
"--no-build"],
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
|
**_low_priority,
|
||||||
)
|
)
|
||||||
if result.returncode != 0:
|
if result.returncode != 0:
|
||||||
log.error("rebuild[%s]: merge failed (rc=%d):\n%s\n%s",
|
log.error("rebuild[%s]: merge failed (rc=%d):\n%s\n%s",
|
||||||
|
|||||||
Reference in New Issue
Block a user