fix: skip heavy post-import consolidation on non-final clone chunks
The flush after every 400-item chunk was running expensive operations (reconcileOfferIds, rebuildCatalog, verifySpriteIds, rcon updates) which caused the import to hang after ~800 items. Now only the final chunk triggers the full consolidation. Also raised the per-request limit from 500 to 5000 items.
This commit is contained in:
1 parent
d4fbbfa243
commit
52516a368d
2 files changed
+8
-2
No files matched your search
@@ -34,6 +34,7 @@ export const POST = withAdmin(
|
||||
const body = await request.json();
|
||||
const sourceId: string = body.sourceId || "";
|
||||
const rawClassnames: string[] = body.classnames || [];
|
||||
const isFinal = body.final === true;
|
||||
|
||||
if (!sourceId) return apiError("Missing sourceId", 400);
|
||||
if (rawClassnames.length === 0)
|
||||
@@ -65,8 +66,8 @@ export const POST = withAdmin(
|
||||
}
|
||||
}
|
||||
|
||||
if (items.length > 500)
|
||||
return apiError("Too many classnames (max 500)", 400);
|
||||
if (items.length > 5000)
|
||||
return apiError("Too many classnames (max 5000)", 400);
|
||||
|
||||
// FurnitureData entries for successfully cloned items are appended once
|
||||
// at the end (single read-modify-write instead of one per item), which
|
||||
@@ -138,6 +139,8 @@ export const POST = withAdmin(
|
||||
);
|
||||
}
|
||||
|
||||
if (!isFinal) return;
|
||||
|
||||
// Post-import consolidation, mirroring the furni batch route:
|
||||
// force offer_id to mirror its catalog row id, keep the
|
||||
// FurnitureData in sync with the new local sprite ids, verify
|
||||
|
||||
Reference in new issue
Block a user