Skip to content

Commit d802b03

Browse files
author
Miriad
committed
fix: MVP infographic limits — BATCH_SIZE=1, max 4 prompts, maxDuration=60
Hobby plan hard-caps at 60s. Fluid Compute only helps Pro. - BATCH_SIZE=1: 2 Gemini calls × ~12s = ~24s per cycle - MAX_INFOGRAPHIC_PROMPTS=4: 4 prompts × 2 orientations = 8 images total - 4 cycles × 5 min = ~20 min per video - maxDuration back to 60 (Hobby limit)
1 parent 81a00f2 commit d802b03

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

app/api/cron/check-research/route.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const fetchCache = 'force-no-store';
2-
export const maxDuration = 300; // Fluid Compute enabled
2+
export const maxDuration = 60;
33

44
import { type NextRequest } from 'next/server';
55
import { createClient, type SanityClient } from 'next-sanity';
@@ -118,7 +118,8 @@ async function buildStuckThresholds(): Promise<Record<string, number>> {
118118
const MAX_DOCS_PER_STATUS = 2;
119119

120120
/** Max prompts to process per cron cycle (each prompt = 2 Imagen calls) */
121-
const INFOGRAPHIC_BATCH_SIZE = 5; // Fluid Compute enabled (300s limit)
121+
const INFOGRAPHIC_BATCH_SIZE = 1; // MVP: 1 prompt per cycle (2 Gemini calls ~24s, fits in 60s Hobby)
122+
const MAX_INFOGRAPHIC_PROMPTS = 4; // MVP: limit total infographics (4 prompts × 2 orientations = 8 images)
122123

123124
// ---------------------------------------------------------------------------
124125
// Sanity Write Client
@@ -251,6 +252,10 @@ async function stepResearchComplete(
251252
}
252253
}
253254

255+
// MVP: cap total prompts
256+
if (sceneImagePrompts.length > MAX_INFOGRAPHIC_PROMPTS) {
257+
sceneImagePrompts.length = MAX_INFOGRAPHIC_PROMPTS;
258+
}
254259
const total = sceneImagePrompts.length > 0
255260
? sceneImagePrompts.length * 2 // both orientations
256261
: 10; // fallback: 5 topic-level x 2
@@ -300,6 +305,10 @@ async function stepInfographicsGenerating(
300305
}
301306
}
302307
}
308+
// MVP: cap total prompts
309+
if (sceneImagePrompts.length > MAX_INFOGRAPHIC_PROMPTS) {
310+
sceneImagePrompts.length = MAX_INFOGRAPHIC_PROMPTS;
311+
}
303312

304313
// Determine which prompts to process this cycle
305314
const completedPrompts = Math.floor(progress.completed / 2); // each prompt = 2 images

0 commit comments

Comments
 (0)