|
1 | 1 | export const fetchCache = 'force-no-store'; |
2 | | -export const maxDuration = 300; // Fluid Compute enabled |
| 2 | +export const maxDuration = 60; |
3 | 3 |
|
4 | 4 | import { type NextRequest } from 'next/server'; |
5 | 5 | import { createClient, type SanityClient } from 'next-sanity'; |
@@ -118,7 +118,8 @@ async function buildStuckThresholds(): Promise<Record<string, number>> { |
118 | 118 | const MAX_DOCS_PER_STATUS = 2; |
119 | 119 |
|
120 | 120 | /** 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) |
122 | 123 |
|
123 | 124 | // --------------------------------------------------------------------------- |
124 | 125 | // Sanity Write Client |
@@ -251,6 +252,10 @@ async function stepResearchComplete( |
251 | 252 | } |
252 | 253 | } |
253 | 254 |
|
| 255 | + // MVP: cap total prompts |
| 256 | + if (sceneImagePrompts.length > MAX_INFOGRAPHIC_PROMPTS) { |
| 257 | + sceneImagePrompts.length = MAX_INFOGRAPHIC_PROMPTS; |
| 258 | + } |
254 | 259 | const total = sceneImagePrompts.length > 0 |
255 | 260 | ? sceneImagePrompts.length * 2 // both orientations |
256 | 261 | : 10; // fallback: 5 topic-level x 2 |
@@ -300,6 +305,10 @@ async function stepInfographicsGenerating( |
300 | 305 | } |
301 | 306 | } |
302 | 307 | } |
| 308 | + // MVP: cap total prompts |
| 309 | + if (sceneImagePrompts.length > MAX_INFOGRAPHIC_PROMPTS) { |
| 310 | + sceneImagePrompts.length = MAX_INFOGRAPHIC_PROMPTS; |
| 311 | + } |
303 | 312 |
|
304 | 313 | // Determine which prompts to process this cycle |
305 | 314 | const completedPrompts = Math.floor(progress.completed / 2); // each prompt = 2 images |
|
0 commit comments