Merge pull request #4618 from superman2003/fix/system-update-detach-request-ctx

fix(update): detach in-place update from the HTTP request lifetime
This commit is contained in:
Wesley Liddick
2026-07-20 10:26:47 +08:00
committed by GitHub
3 changed files with 114 additions and 19 deletions
+13 -2
View File
@@ -61,12 +61,22 @@ export async function getRollbackVersions(): Promise<{ versions: RollbackVersion
return data
}
/**
* In-place update/rollback downloads a full release binary from GitHub, which
* can take several minutes on slow links. The global 30s axios timeout would
* abort the request mid-download (#4504), so these calls wait as long as the
* backend allows (15 minutes server-side).
*/
const UPDATE_REQUEST_TIMEOUT_MS = 15 * 60 * 1000
/**
* Perform system update
* Downloads and applies the latest version
*/
export async function performUpdate(): Promise<UpdateResult> {
const { data } = await apiClient.post<UpdateResult>('/admin/system/update')
const { data } = await apiClient.post<UpdateResult>('/admin/system/update', undefined, {
timeout: UPDATE_REQUEST_TIMEOUT_MS
})
return data
}
@@ -77,7 +87,8 @@ export async function performUpdate(): Promise<UpdateResult> {
export async function rollback(version?: string): Promise<UpdateResult> {
const { data } = await apiClient.post<UpdateResult>(
'/admin/system/rollback',
version ? { version } : undefined
version ? { version } : undefined,
{ timeout: UPDATE_REQUEST_TIMEOUT_MS }
)
return data
}