fix: 修复 Pages 部署包上传报「请求超时,请稍后重试」

This commit is contained in:
ryan
2026-06-21 10:39:08 +08:00
parent b12a9b0185
commit 665dd09e11
5 changed files with 14 additions and 3 deletions
+2
View File
@@ -22,6 +22,8 @@ sidebar: false
### 修复 ### 修复
- 修复 Pages 部署包上传报「请求超时,请稍后重试」:上传请求使用独立 10 分钟超时(覆盖默认 15 秒),并在大文件上传完成后提示服务端处理中。
- 修复应用日志异常膨胀:Agent 配置同步加锁避免并发重复上报,成功且版本/checksum 未变时跳过重复 apply 日志;Server 入库前对相同成功记录去重;Flared 配置未变更时不再上报 apply 日志。 - 修复应用日志异常膨胀:Agent 配置同步加锁避免并发重复上报,成功且版本/checksum 未变时跳过重复 apply 日志;Server 入库前对相同成功记录去重;Flared 配置未变更时不再上报 apply 日志。
- 修复应用日志页「清空」无效果:原按钮仅重置筛选;新增「清空日志」入口并对接 `/api/v1/d/apply-logs/cleanup`,支持确认后删除全部记录。 - 修复应用日志页「清空」无效果:原按钮仅重置筛选;新增「清空日志」入口并对接 `/api/v1/d/apply-logs/cleanup`,支持确认后删除全部记录。
@@ -141,10 +141,10 @@ export function DeploymentUploadDialog({
{uploadProgress !== null ? ( {uploadProgress !== null ? (
<div className="space-y-1.5"> <div className="space-y-1.5">
<div className="flex justify-between text-xs text-muted-foreground"> <div className="flex justify-between text-xs text-muted-foreground">
<span>上传进度</span> <span>{uploadProgress >= 100 ? "服务端处理中" : "上传进度"}</span>
<span>{uploadProgress}%</span> <span>{uploadProgress >= 100 ? "请稍候" : `${uploadProgress}%`}</span>
</div> </div>
<Progress value={uploadProgress} /> <Progress value={uploadProgress >= 100 ? 100 : uploadProgress} />
</div> </div>
) : null} ) : null}
+5
View File
@@ -21,6 +21,11 @@ export const apiConfig = {
baseURL: getApiBaseUrl(), baseURL: getApiBaseUrl(),
/** 超时时间(毫秒) */ /** 超时时间(毫秒) */
timeout: 15000, timeout: 15000,
/**
* 文件上传超时(毫秒)。
* Pages 部署包上限 100 MiB,需覆盖上传 + 服务端解压校验与入库时间。
*/
uploadTimeout: 10 * 60 * 1000,
/** 携带凭证 */ /** 携带凭证 */
withCredentials: true, withCredentials: true,
} as const; } as const;
@@ -1,6 +1,7 @@
import type {AxiosProgressEvent, InternalAxiosRequestConfig} from 'axios'; import type {AxiosProgressEvent, InternalAxiosRequestConfig} from 'axios';
import apiClient from '@/lib/services/core/api-client'; import apiClient from '@/lib/services/core/api-client';
import {apiConfig} from '@/lib/services/core/config';
import type {ApiResponse} from '@/lib/services/core'; import type {ApiResponse} from '@/lib/services/core';
import {OpenFlareBaseService} from './base.service'; import {OpenFlareBaseService} from './base.service';
@@ -94,6 +95,7 @@ export class PagesService extends OpenFlareBaseService {
this.getFullPath(path), this.getFullPath(path),
formData, formData,
{ {
timeout: apiConfig.uploadTimeout,
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
onUploadProgress: (event: AxiosProgressEvent) => { onUploadProgress: (event: AxiosProgressEvent) => {
if (!onProgress || !event.total) return; if (!onProgress || !event.total) return;
@@ -1,5 +1,6 @@
import type {InternalAxiosRequestConfig} from 'axios'; import type {InternalAxiosRequestConfig} from 'axios';
import {apiConfig} from '../core/config';
import {BaseService} from '../core/base.service'; import {BaseService} from '../core/base.service';
import type {ListUploadsResponse, Upload, UploadImageResponse} from './types'; import type {ListUploadsResponse, Upload, UploadImageResponse} from './types';
@@ -23,6 +24,7 @@ export class UploadService extends BaseService {
} }
return this.post<Upload>('', formData, { return this.post<Upload>('', formData, {
timeout: apiConfig.uploadTimeout,
headers: { 'Content-Type': 'multipart/form-data' }, headers: { 'Content-Type': 'multipart/form-data' },
} as InternalAxiosRequestConfig); } as InternalAxiosRequestConfig);
} }