Report renderer progress and detect stalled jobs

This commit is contained in:
2026-10-04 20:25:06 +05:00
parent 3b3cf6997c
commit 3bdf987916
11 changed files with 277 additions and 25 deletions

View File

@@ -338,7 +338,9 @@ export async function handle(request: NextRequest, path: string[]) {
const maps = required(
await client
.from("datasets")
.select("*, upload_jobs(state,progress,error)")
.select(
"*, upload_jobs(state,progress,error,updated_at,lease_until)",
)
.eq("owner_id", owner)
.order("created_at", { ascending: false }),
);
@@ -362,8 +364,15 @@ export async function handle(request: NextRequest, path: string[]) {
.single(),
);
const manifest = datasetSchema.parse(input.manifest);
const jobResult = await client
.from("upload_jobs")
.select("state,progress,error,updated_at,lease_until")
.eq("dataset_id", d.id)
.maybeSingle();
if (jobResult.error) throw new Error(jobResult.error.message);
return NextResponse.json({
...d,
upload_jobs: jobResult.data,
manifest,
map: await mediaUrl(d.map_path),
previews: await Promise.all(