BIG MOOOOVE to Object Storage 2
Deploy / deploy (push) Successful in 2m42s

This commit is contained in:
twotalesanimation
2026-07-16 22:33:25 +02:00
parent 745634f1b6
commit 9375d5212c
+9 -2
View File
@@ -140,7 +140,10 @@ export default function MigrationPage() {
if (!toMigrate.length) return; if (!toMigrate.length) return;
setMigrating(true); setMigrating(true);
for (const file of toMigrate) { // Process in batches of CONCURRENCY to upload multiple files in parallel
const CONCURRENCY = 5;
const migrateOne = async (file: FileEntry) => {
setStatuses((prev) => new Map(prev).set(file.key, "uploading")); setStatuses((prev) => new Map(prev).set(file.key, "uploading"));
try { try {
const res = await fetch("/api/admin/migration", { const res = await fetch("/api/admin/migration", {
@@ -151,7 +154,6 @@ export default function MigrationPage() {
const data = await res.json(); const data = await res.json();
if (!res.ok) throw new Error(data.error ?? "Upload failed"); if (!res.ok) throw new Error(data.error ?? "Upload failed");
setStatuses((prev) => new Map(prev).set(file.key, "done")); setStatuses((prev) => new Map(prev).set(file.key, "done"));
// Mark as synced in the file list
setFiles((prev) => setFiles((prev) =>
prev.map((f) => (f.key === file.key ? { ...f, hetznerExists: true } : f)) prev.map((f) => (f.key === file.key ? { ...f, hetznerExists: true } : f))
); );
@@ -161,6 +163,11 @@ export default function MigrationPage() {
new Map(prev).set(file.key, e instanceof Error ? e.message : "Failed") new Map(prev).set(file.key, e instanceof Error ? e.message : "Failed")
); );
} }
};
// Run in batches of CONCURRENCY
for (let i = 0; i < toMigrate.length; i += CONCURRENCY) {
await Promise.all(toMigrate.slice(i, i + CONCURRENCY).map(migrateOne));
} }
setMigrating(false); setMigrating(false);