Bump frontend version upload timeout (#6333)

Bump upload timeout
This commit is contained in:
aecsocket
2026-06-08 16:43:18 +01:00
committed by GitHub
parent 7366c32df3
commit c7ba6ba8b2
2 changed files with 9 additions and 2 deletions
@@ -2,6 +2,8 @@ import { AbstractModule } from '../../../core/abstract-module'
import type { UploadHandle } from '../../../types/upload' import type { UploadHandle } from '../../../types/upload'
import type { Labrinth } from '../types' import type { Labrinth } from '../types'
const VERSION_UPLOAD_TIMEOUT_MS = 30 * 60 * 1000
export class LabrinthVersionsV3Module extends AbstractModule { export class LabrinthVersionsV3Module extends AbstractModule {
public getModuleID(): string { public getModuleID(): string {
return 'labrinth_versions_v3' return 'labrinth_versions_v3'
@@ -199,7 +201,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
api: 'labrinth', api: 'labrinth',
version: 3, version: 3,
formData, formData,
timeout: 60 * 5 * 1000, timeout: VERSION_UPLOAD_TIMEOUT_MS,
}) })
} }
@@ -284,7 +286,7 @@ export class LabrinthVersionsV3Module extends AbstractModule {
api: 'labrinth', api: 'labrinth',
version: 2, version: 2,
formData, formData,
timeout: 60 * 5 * 1000, timeout: VERSION_UPLOAD_TIMEOUT_MS,
}) })
} }
} }
@@ -122,6 +122,11 @@ export abstract class XHRUploadClient extends AbstractModrinthClient {
xhr.addEventListener('error', () => reject(new ModrinthApiError('Upload failed'))) xhr.addEventListener('error', () => reject(new ModrinthApiError('Upload failed')))
xhr.addEventListener('abort', () => reject(new ModrinthApiError('Upload cancelled'))) xhr.addEventListener('abort', () => reject(new ModrinthApiError('Upload cancelled')))
xhr.addEventListener('timeout', () => reject(new ModrinthApiError('Upload timed out')))
if (context.options.timeout !== undefined) {
xhr.timeout = context.options.timeout
}
// build URL with params (unlike $fetch, XHR doesn't handle params automatically) // build URL with params (unlike $fetch, XHR doesn't handle params automatically)
let url = context.url let url = context.url