fix: error
This commit is contained in:
parent
95a6ad7770
commit
132e1e9acd
1 changed files with 13 additions and 3 deletions
|
|
@ -41,9 +41,19 @@ export async function handler(key: string, event: string): Promise<boolean> {
|
|||
}
|
||||
|
||||
if (!cachedMetadata[key]) {
|
||||
const stat = await minioClient.statObject(bucket, pathname);
|
||||
cachedMetadata[key] = { size: stat.size, type: stat.metaData["content-type"] };
|
||||
if (stat.size > 1024 * 1024 * 100) cachedBuffer[key] = Buffer.from([]);
|
||||
try {
|
||||
const stat = await minioClient.statObject(bucket, pathname);
|
||||
cachedMetadata[key] = { size: stat.size, type: stat.metaData["content-type"] };
|
||||
if (stat.size > 1024 * 1024 * 100) cachedBuffer[key] = Buffer.from([]);
|
||||
} catch (e: any) {
|
||||
if (e.code === "NoSuchKey") {
|
||||
console.info(`[AMQ] Key: ${key} received but cannot be found.`);
|
||||
delete cachedBuffer[key];
|
||||
delete cachedMetadata[key];
|
||||
await ensureDelete(pathname);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cachedBuffer[key]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue