@@ -5,11 +5,10 @@ import { resolveAllImports, resolveAllImportsSources } from "@/lib/import-resolv
55import { checkRateLimit , getRateLimitReset } from "@/lib/rate-limiter" ;
66
77export const runtime = "nodejs" ;
8- export const maxDuration = 120 ;
8+ export const maxDuration = 60 ;
99
1010const MAX_BODY_SIZE = 512000 ; // 500KB
11- const WORKER_TIMEOUT_EVM_MS = 30_000 ;
12- const WORKER_TIMEOUT_PVM_MS = 90_000 ; // resolc is significantly slower than solc
11+ const WORKER_TIMEOUT_MS = 30_000 ;
1312
1413interface CompileRequest {
1514 source ?: string ;
@@ -29,18 +28,17 @@ interface CompileResponse {
2928function compileInWorker (
3029 input : string ,
3130 mode : string ,
32- timeoutMs ?: number
31+ timeoutMs = WORKER_TIMEOUT_MS
3332) : Promise < any > {
34- const timeout = timeoutMs ?? ( mode === "pvm" ? WORKER_TIMEOUT_PVM_MS : WORKER_TIMEOUT_EVM_MS ) ;
3533 return new Promise ( ( resolve , reject ) => {
3634 const worker = new Worker ( COMPILE_WORKER_CODE , {
3735 eval : true ,
3836 workerData : { mode, input } ,
3937 } ) ;
4038 const timer = setTimeout ( ( ) => {
4139 worker . terminate ( ) ;
42- reject ( new Error ( ` Compilation timed out after ${ Math . round ( timeout / 1000 ) } s` ) ) ;
43- } , timeout ) ;
40+ reject ( new Error ( " Compilation timed out after 30s" ) ) ;
41+ } , timeoutMs ) ;
4442
4543 worker . on ( "message" , ( msg ) => {
4644 clearTimeout ( timer ) ;
0 commit comments