From 9d00afc23fca94056ce630dfdd91e16010cad7aa Mon Sep 17 00:00:00 2001 From: joonhoekim <26rote@gmail.com> Date: Thu, 6 Nov 2025 15:06:21 +0900 Subject: (김준회) PQ 및 실사 캐싱 제거 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pq/service.ts | 43 ++++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 19 deletions(-) (limited to 'lib/pq/service.ts') diff --git a/lib/pq/service.ts b/lib/pq/service.ts index bc3f37a0..15d9aebc 100644 --- a/lib/pq/service.ts +++ b/lib/pq/service.ts @@ -1451,6 +1451,8 @@ export interface VendorPQsList { } export async function getVendorPQsList(vendorId: number): Promise { + unstable_noStore(); + try { // 1. Check if vendor has general PQ answers const generalPqAnswers = await db @@ -1539,6 +1541,8 @@ export async function loadProjectPQAction(vendorId: number, projectId?: number): export async function getAllPQsByVendorId(vendorId: number) { + unstable_noStore(); + try { const pqList = await db .select({ @@ -1569,6 +1573,8 @@ export async function getAllPQsByVendorId(vendorId: number) { // 특정 PQ의 상세 정보 조회 (개별 PQ 페이지용) export async function getPQById(pqSubmissionId: number, vendorId: number) { + unstable_noStore(); + try { const pq = await db @@ -1679,8 +1685,8 @@ function getStatusLabel(status: string): string { } export async function getPQSubmissions(input: GetPQSubmissionsSchema) { - return unstable_cache( - async () => { + unstable_noStore(); + try { const offset = (input.page - 1) * input.perPage; @@ -1989,16 +1995,11 @@ export async function getPQSubmissions(input: GetPQSubmissionsSchema) { console.error("Error in getPQSubmissions:", err); return { data: [], pageCount: 0 }; } - }, - [JSON.stringify(input)], // 캐싱 키 - { - revalidate: 3600, - tags: ["pq-submissions"], // revalidateTag 호출 시 무효화 - } - )(); } export async function getPQStatusCountsAll() { + unstable_noStore(); + try { // 모든 PQ 상태별 개수 조회 (벤더 제한 없음) const pqStatuses = await db @@ -3046,8 +3047,12 @@ export async function requestInvestigationAction( // 이메일 발송 실패는 로그만 남기고 전체 프로세스는 성공으로 처리 console.error("이메일 발송 중 오류 발생:", emailErr); } - revalidatePath("/evcp/pq_new"); - revalidatePath("/evcp/vendor-investigation"); + + // 캐시 무효화 (skipRevalidation 옵션이 false일 때만) + if (!options?.skipRevalidation) { + revalidateTag("vendor-investigations") + revalidateTag("pq-submissions") + } return { success: true, @@ -3092,11 +3097,9 @@ export async function cancelInvestigationAction(investigationIds: number[]) { return updatedInvestigations }) - // 캐시 무효화 (핸들러에서 호출 시에는 건너뛰기) - if (!options?.skipRevalidation) { - revalidateTag("vendor-investigations") - revalidateTag("pq-submissions") - } + // 캐시 무효화 + revalidateTag("vendor-investigations") + revalidateTag("pq-submissions") return { success: true, @@ -3160,9 +3163,11 @@ export async function reRequestInvestigationAction( return updatedInvestigations }) - // 캐시 무효화 - revalidateTag("vendor-investigations") - revalidateTag("pq-submissions") + // 캐시 무효화 (skipRevalidation 옵션이 false일 때만) + if (!options?.skipRevalidation) { + revalidateTag("vendor-investigations") + revalidateTag("pq-submissions") + } return { success: true, -- cgit v1.2.3