improvement(timeouts): files/base64 should use max timeouts

This commit is contained in:
Vikhyath Mondreti
2026-02-10 10:55:53 -08:00
parent e321f883b0
commit 8902752c17
4 changed files with 9 additions and 4 deletions

View File

@@ -76,7 +76,7 @@ export async function GET(
}
if (job.status === JOB_STATUS.PROCESSING || job.status === JOB_STATUS.PENDING) {
response.estimatedDuration = 180000
response.estimatedDuration = 300000
}
return NextResponse.json(response)

View File

@@ -14,7 +14,7 @@ import { mistralParserTool } from '@/tools/mistral/parser'
const logger = createLogger('DocumentProcessor')
const TIMEOUTS = {
FILE_DOWNLOAD: 180000,
FILE_DOWNLOAD: 600000,
MISTRAL_OCR_API: 120000,
} as const

View File

@@ -1,6 +1,7 @@
'use server'
import type { Logger } from '@sim/logger'
import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
import {
secureFetchWithPinnedIP,
validateUrlWithDNS,
@@ -135,7 +136,10 @@ export async function resolveFileInputToUrl(
* For internal URLs, uses direct storage access (server-side only)
* For external URLs, validates DNS/SSRF and uses secure fetch with IP pinning
*/
export async function downloadFileFromUrl(fileUrl: string, timeoutMs = 180000): Promise<Buffer> {
export async function downloadFileFromUrl(
fileUrl: string,
timeoutMs = getMaxExecutionTimeout()
): Promise<Buffer> {
const { parseInternalFileUrl } = await import('./file-utils')
if (isInternalFileUrl(fileUrl)) {

View File

@@ -1,13 +1,14 @@
import type { Logger } from '@sim/logger'
import { createLogger } from '@sim/logger'
import { getRedisClient } from '@/lib/core/config/redis'
import { getMaxExecutionTimeout } from '@/lib/core/execution-limits'
import { isUserFileWithMetadata } from '@/lib/core/utils/user-file'
import { bufferToBase64 } from '@/lib/uploads/utils/file-utils'
import { downloadFileFromStorage, downloadFileFromUrl } from '@/lib/uploads/utils/file-utils.server'
import type { UserFile } from '@/executor/types'
const DEFAULT_MAX_BASE64_BYTES = 10 * 1024 * 1024
const DEFAULT_TIMEOUT_MS = 180000
const DEFAULT_TIMEOUT_MS = getMaxExecutionTimeout()
const DEFAULT_CACHE_TTL_SECONDS = 300
const REDIS_KEY_PREFIX = 'user-file:base64:'