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) {
|
while (Date.now() < deadline) {
|
||||||
await sleep(STYLE_PRO_TASK_POLL_INTERVAL_MS);
|
await sleep(STYLE_PRO_TASK_POLL_INTERVAL_MS);
|
||||||
|
|
||||||
const statusResponse = await fetch(
|
let statusResponse: Response;
|
||||||
`/api/style-pro/generate?taskId=${encodeURIComponent(taskId)}`,
|
try {
|
||||||
{ cache: "no-store" }
|
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
|
const statusPayload = (await statusResponse.json().catch(() => ({}))) as
|
||||||
| StyleProGenerateResponse
|
| StyleProGenerateResponse
|
||||||
| undefined;
|
| undefined;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user