mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-11-04 08:10:28 +09:00
Svelte 컴포넌트를 제외한 파일, 폴더 및 라우팅 경로의 이름을 kebab-case로 통일하고 import 경로에 실제 파일 확장자를 사용하도록 변경
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
225ad3515f
commit
306fcb2420
201 files changed
+550
-545
No files matched your search
@@ -0,0 +1,44 @@
|
||||
import { FileDeletionRepo } from "#lib/server/db/index.ts";
|
||||
import { deleteFile } from "#lib/server/storage/index.ts";
|
||||
|
||||
const BATCH_SIZE = 100;
|
||||
|
||||
// Deletes files enqueued by committed transactions. Failed deletions are retried later.
|
||||
export const processPendingFileDeletions = async () => {
|
||||
while (true) {
|
||||
const deletions = await FileDeletionRepo.getPendingFileDeletions(BATCH_SIZE);
|
||||
if (deletions.length === 0) return;
|
||||
|
||||
const results = await Promise.allSettled(deletions.map(({ path }) => deleteFile(path)));
|
||||
const deletedIds = deletions
|
||||
.filter((_, i) => results[i]!.status === "fulfilled")
|
||||
.map(({ id }) => id);
|
||||
results.forEach((result) => {
|
||||
if (result.status === "rejected") console.error(result.reason);
|
||||
});
|
||||
|
||||
await FileDeletionRepo.completeFileDeletions(deletedIds);
|
||||
if (deletedIds.length < deletions.length) return; // Retry later
|
||||
}
|
||||
};
|
||||
|
||||
let processing: Promise<void> | undefined;
|
||||
let isRequestedAgain = false;
|
||||
|
||||
export const schedulePendingFileDeletions = () => {
|
||||
if (processing) {
|
||||
isRequestedAgain = true;
|
||||
return;
|
||||
}
|
||||
|
||||
processing = (async () => {
|
||||
do {
|
||||
isRequestedAgain = false;
|
||||
await processPendingFileDeletions();
|
||||
} while (isRequestedAgain);
|
||||
})()
|
||||
.catch(console.error)
|
||||
.finally(() => {
|
||||
processing = undefined;
|
||||
});
|
||||
};
|
||||
Reference in new issue
Block a user