Skip to content

Commit b1b5038

Browse files
committed
defer loading tables that require too many files
1 parent 5cb526a commit b1b5038

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/workers/db.worker.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,8 @@ function sendResponse(
523523
}
524524
}
525525

526-
const LARGE_FILE_THRESHOLD = 4 * 1024 * 1024;
526+
const LARGE_FILE_THRESHOLD = 1 * 1024 * 1024;
527+
const MAX_AUTO_LOAD_FILES = 10;
527528

528529
function sendMessageToZipWorker(message: {
529530
type: string;
@@ -756,9 +757,13 @@ async function startTableLoading(message: StartTableLoadingMessage) {
756757
continue;
757758
}
758759

760+
// Count how many files this table requires
761+
const fileCount = table.nodeFiles ? table.nodeFiles.length : 1;
762+
759763
if (
760764
table.size > LARGE_FILE_THRESHOLD ||
761-
(tables.length > 300 && table.path.includes("/nodes/"))
765+
(tables.length > 300 && table.path.includes("/nodes/")) ||
766+
fileCount > MAX_AUTO_LOAD_FILES
762767
) {
763768
self.postMessage({
764769
type: "tableLoadProgress",

0 commit comments

Comments
 (0)