perf : cache
CI / Verify (push) Successful in 1m56s
CI / Build immutable images and deploy (push) Successful in 3m12s

This commit is contained in:
2026-10-08 23:21:34 +07:00 Unverified
parent 36063fc214
commit 9580407a90
58 changed files with 5797 additions and 5336 deletions
+12
View File
@@ -3,8 +3,12 @@ import { join } from "node:path";
import { sql } from "drizzle-orm";
import * as z from "zod";
import { CATALOG_CACHE_TAG, DIRECTORY_CACHE_TAG, STYGIAN_CACHE_TAG } from "@/lib/cache/tags";
import { createRedisOutboxTransport } from "@/lib/outbox/processor";
import { getDb } from "@/db/client";
import {
outboxEvents,
catalogArtifacts,
catalogCharacters,
catalogMaterials,
@@ -644,7 +648,15 @@ async function syncCatalogVersion(version: string, control?: SyncControl): Promi
imageKey: item.imageKey,
})),
);
const eventId = crypto.randomUUID();
await tx.insert(outboxEvents).values({
topic: "admin", aggregateId: eventId, eventType: "catalog.updated",
payload: { id: eventId, version: Date.now() },
});
});
await createRedisOutboxTransport(await getRedisClient()).invalidate(
[CATALOG_CACHE_TAG, DIRECTORY_CACHE_TAG, STYGIAN_CACHE_TAG], Date.now(),
);
await control?.report("database", 1, 1, "บันทึก Catalog แล้ว");
await storage.write("catalog/current.json", JSON.stringify({
version,