fix: cache not clear

This commit is contained in:
Methapon2001 2023-11-24 14:46:34 +07:00
parent 7cdbf140a9
commit 9ca1213e50
No known key found for this signature in database
GPG key ID: 849924FEF46BD132
3 changed files with 136 additions and 1 deletions

View file

@ -2,6 +2,7 @@ import { EhrFile } from "../interfaces/ehr-fs";
import esClient from "../elasticsearch";
import minioClient from "../storage";
// for failed queue that will come later
const cachedBuffer: Record<string, Buffer> = {};
export async function handler(key: string): Promise<boolean> {
@ -22,6 +23,8 @@ export async function handler(key: string): Promise<boolean> {
? await handleFoundRecord(rec, cachedBuffer[key])
: await handleNotFoundRecord(pathname, cachedBuffer[key]);
if (result) delete cachedBuffer[key];
return result;
}