refactor: universal logger and remove N+1 catalog queries
CI / check (push) Successful in 28s
CI / tests-ui (push) Failing after 32s
CI / tests-unit (push) Successful in 1m43s
CI / tests-quality (push) Successful in 1m14s
CI / tests-integration (push) Successful in 1m50s
CI / preflight (push) Skipped
CI / deploy (push) Skipped
CI / tests-imaging-browsers (push) Successful in 1m56s
CI / check (push) Successful in 28s
CI / tests-ui (push) Failing after 32s
CI / tests-unit (push) Successful in 1m43s
CI / tests-quality (push) Successful in 1m14s
CI / tests-integration (push) Successful in 1m50s
CI / preflight (push) Skipped
CI / deploy (push) Skipped
CI / tests-imaging-browsers (push) Successful in 1m56s
- Replace all 39 console.* calls with universal logger (pino server, console browser) - Set server-only marker on import-badge.ts - Disable DB query logging in production - Add bulkInsertCatalogItems: one transaction instead of N per-item inserts - Add reserveCatalogItemIds helper for bulk ID allocation - Optimize translateCatalogItems: single inArray batch query instead of N per-item selects - Test mock updated for logger.debug - biome clean, tsc clean, 3569 tests passing
This commit is contained in:
1 parent
6895eaab49
commit
59a45d2165
27 files changed
+416
-241
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
} from "@/lib/furni/bundle-file";
|
||||
import { isSafeAssetName, normalizeClassname } from "@/lib/furni/classname";
|
||||
import { localFurnitureStatus } from "@/lib/furni/local-presence";
|
||||
import { logger } from "@/lib/logger";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { logAudit } from "@/lib/services/audit";
|
||||
import { getCloneList } from "@/lib/services/clone-import";
|
||||
@@ -446,9 +447,8 @@ export const POST = withAdmin(
|
||||
try {
|
||||
await appendFurniEntriesBulk(collectedFurniEntries);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] Bulk FurnitureData.json write failed:",
|
||||
(err as Error).message,
|
||||
logger.warn(
|
||||
`[import-furni] Bulk FurnitureData.json write failed: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -458,9 +458,8 @@ export const POST = withAdmin(
|
||||
await rcon.updateCatalog();
|
||||
await rcon.updateItems();
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] RCON update failed after batch:",
|
||||
(err as Error).message,
|
||||
logger.warn(
|
||||
`[import-furni] RCON update failed after batch: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
invalidateCatalogTotals();
|
||||
@@ -509,9 +508,8 @@ export const POST = withAdmin(
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] Localized furnidata build failed:",
|
||||
(err as Error).message,
|
||||
logger.warn(
|
||||
`[import-furni] Localized furnidata build failed: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -588,9 +586,8 @@ export const POST = withAdmin(
|
||||
await rcon.updateCatalog();
|
||||
await rcon.updateItems();
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] RCON update failed:",
|
||||
(err as Error).message,
|
||||
logger.warn(
|
||||
`[import-furni] RCON update failed: ${(err as Error).message}`,
|
||||
);
|
||||
result.warnings.push("RCON cache refresh failed");
|
||||
}
|
||||
@@ -640,9 +637,8 @@ export const POST = withAdmin(
|
||||
);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
"[import-furni] Localized patch failed:",
|
||||
(err as Error).message,
|
||||
logger.warn(
|
||||
`[import-furni] Localized patch failed: ${(err as Error).message}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -850,9 +846,8 @@ export const PATCH = withAdmin(
|
||||
await appendFurniEntry(entry, itemType);
|
||||
}
|
||||
} catch (fdErr) {
|
||||
console.warn(
|
||||
`[regen] FurnitureData update skipped for ${item.classname}:`,
|
||||
(fdErr as Error).message,
|
||||
logger.warn(
|
||||
`[regen] FurnitureData update skipped for ${item.classname}: ${(fdErr as Error).message}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user