Skip to content

Commit 4ff3871

Browse files
committed
Check the whitebox code out in RAM when there is room, else on disk
The whitebox read of a mapped repository now asks for a RAM backed checkout in shared memory, which is faster and never written to disk. The fetch already falls back to the temp directory when shared memory is missing or tight on space, so a low memory host still works. The checkout is shallow, read only, and removed the moment the read finishes either way, and only the routes and sinks it yields are kept, never the source.
1 parent dbf3a0d commit 4ff3871

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎app/core/external.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,9 @@ def _whitebox(scan_id: int, asset_id: int, host: str) -> dict:
19731973
entry = {"repository": name, "branch": branch, "routes": 0,
19741974
"host_in_code": [], "error": ""}
19751975
try:
1976-
with recheck.branch_tip(connection, name, branch) as (root, why):
1976+
# Prefer a RAM backed checkout (/dev/shm): faster and never on disk.
1977+
# branch_tip falls back to the temp directory when RAM is tight.
1978+
with recheck.branch_tip(connection, name, branch, in_memory=True) as (root, why):
19771979
if root is None:
19781980
entry["error"] = why or "could not fetch it"
19791981
else:

0 commit comments

Comments
 (0)