serialize batch image processing requests
This commit is contained in:
parent
82233b5f3a
commit
0a2b8b3045
@ -56,7 +56,8 @@ const SCENE_FUSION_MODEL_COOLDOWN_MS = 2 * 60 * 1000;
|
||||
const SCENE_FUSION_MAX_ITEMS = 10;
|
||||
const SCENE_FUSION_REQUEST_STAGGER_MS = 350;
|
||||
const SCENE_FUSION_AGENT_TIMEOUT_MS = 20000;
|
||||
const SCENE_FUSION_AGENT_MAX_WORKERS = 2;
|
||||
const SCENE_FUSION_AGENT_MAX_WORKERS = 1;
|
||||
const SCENE_FUSION_PROCESS_MAX_WORKERS = 1;
|
||||
const SCENE_FUSION_PRE_RMBG_TIMEOUT_MS = 60_000;
|
||||
const SCENE_FUSION_ECHO_HASH_TIMEOUT_MS = 20_000;
|
||||
const SCENE_FUSION_ECHO_HASH_THRESHOLD = 8;
|
||||
@ -1895,7 +1896,11 @@ export async function POST(request: Request) {
|
||||
let nextSceneIndex = 0;
|
||||
const workerCount = Math.max(
|
||||
1,
|
||||
Math.min(4, candidateModels.length, processedScenes.length)
|
||||
Math.min(
|
||||
SCENE_FUSION_PROCESS_MAX_WORKERS,
|
||||
candidateModels.length,
|
||||
processedScenes.length
|
||||
)
|
||||
);
|
||||
|
||||
const workers = Array.from({ length: workerCount }, async () => {
|
||||
|
||||
@ -39,6 +39,7 @@ import { cn } from "@/lib/utils";
|
||||
const fetcher = (url: string) => fetch(url).then((res) => res.json());
|
||||
const MAX_BATCH_ITEMS = 10;
|
||||
const BATCH_REQUEST_STAGGER_MS = 700;
|
||||
const BATCH_SERIAL_WORKER_COUNT = 1;
|
||||
const MULTI_PRODUCT_FAILOVER_MAX_ROUNDS = 5;
|
||||
const MULTI_PRODUCT_FAILOVER_RETRY_DELAY_MS = 1500;
|
||||
|
||||
@ -977,7 +978,10 @@ export function SceneFusionView({
|
||||
);
|
||||
|
||||
const queue = [...itemsToProcess];
|
||||
const workerCount = Math.max(1, Math.min(2, queue.length));
|
||||
const workerCount = Math.max(
|
||||
1,
|
||||
Math.min(BATCH_SERIAL_WORKER_COUNT, queue.length)
|
||||
);
|
||||
let successCount = 0;
|
||||
let failedCount = 0;
|
||||
|
||||
@ -1148,7 +1152,10 @@ export function SceneFusionView({
|
||||
);
|
||||
|
||||
const queue = [...itemsToProcess];
|
||||
const workerCount = Math.max(1, Math.min(3, queue.length));
|
||||
const workerCount = Math.max(
|
||||
1,
|
||||
Math.min(BATCH_SERIAL_WORKER_COUNT, queue.length)
|
||||
);
|
||||
let successCount = 0;
|
||||
let failedCount = 0;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user