perf(import): parallelize ID allocation and raise clone concurrency to 10
Replace the serialized SELECT MAX + INSERT id-allocation chains for items_base and catalog_items with a lazy-seeded in-process counter so concurrent clone workers no longer queue on a global lock per item. Re-seeds after 60s idle to avoid colliding with externally added rows. Raise the clone import concurrency default from 6 to the batch cap of 10.
This commit is contained in:
1 parent
742536820a
commit
172941c542
8 files changed
+144
-52
No files matched your search
@@ -1,5 +1,5 @@
|
||||
// @vitest-environment node
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
// biome-ignore lint/suspicious/noExplicitAny: test helper for mocking with arbitrary signatures
|
||||
type AnyFn = (...args: any[]) => any;
|
||||
@@ -69,7 +69,11 @@ vi.mock("@/lib/db", () => ({
|
||||
ItemsBase: { id: "id", itemName: "itemName" },
|
||||
}));
|
||||
|
||||
import { cloneSingleFurni, parseFurnidata } from "./clone-import";
|
||||
import {
|
||||
__resetItemsBaseAllocatorForTests,
|
||||
cloneSingleFurni,
|
||||
parseFurnidata,
|
||||
} from "./clone-import";
|
||||
|
||||
const SOURCE = {
|
||||
id: "s",
|
||||
@@ -92,6 +96,10 @@ const ENTRY = {
|
||||
};
|
||||
|
||||
describe("clone-import", () => {
|
||||
beforeEach(() => {
|
||||
__resetItemsBaseAllocatorForTests();
|
||||
});
|
||||
|
||||
it("parseFurnidata normalizes room + wall items with itemType", () => {
|
||||
const list = parseFurnidata({
|
||||
roomitemtypes: { furnitype: [ENTRY] },
|
||||
|
||||
Reference in new issue
Block a user