fix: tolerate transient style pro task polling failures
This commit is contained in:
parent
4aead3018f
commit
b58e0f945e
@ -1331,10 +1331,18 @@ export function StyleProWorkspace({
|
||||
while (Date.now() < deadline) {
|
||||
await sleep(STYLE_PRO_TASK_POLL_INTERVAL_MS);
|
||||
|
||||
const statusResponse = await fetch(
|
||||
`/api/style-pro/generate?taskId=${encodeURIComponent(taskId)}`,
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
let statusResponse: Response;
|
||||
try {
|
||||
statusResponse = await fetch(
|
||||
`/api/style-pro/generate?taskId=${encodeURIComponent(taskId)}`,
|
||||
{ cache: "no-store" }
|
||||
);
|
||||
} catch (pollError) {
|
||||
lastError =
|
||||
pollError instanceof Error ? pollError.message : "查询任务失败";
|
||||
continue;
|
||||
}
|
||||
|
||||
const statusPayload = (await statusResponse.json().catch(() => ({}))) as
|
||||
| StyleProGenerateResponse
|
||||
| undefined;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user