@@ -36,7 +36,6 @@ export interface PoolConfig {
3636 maxProcesses : number ;
3737 idleTimeout : number ; // milliseconds
3838 minSize : number ;
39- preWarmScript ?: string ;
4039}
4140
4241export interface ExecutorPoolConfig extends PoolConfig {
@@ -49,38 +48,18 @@ const DEFAULT_EXECUTOR_CONFIGS: Record<InterpreterLanguage, ExecutorPoolConfig>
4948 minSize : 3 ,
5049 maxProcesses : 15 ,
5150 idleTimeout : 5 * 60 * 1000 , // 5 minutes
52- preWarmScript : `
53- import json
54- print(json.dumps({"status": "pre-warmed"}))
55- `
5651 } ,
5752 javascript : {
5853 executor : "javascript" ,
5954 minSize : 3 ,
6055 maxProcesses : 10 ,
6156 idleTimeout : 5 * 60 * 1000 ,
62- preWarmScript : `
63- const fs = require('fs');
64- const path = require('path');
65- const util = require('util');
66- const crypto = require('crypto');
67- for(let i = 0; i < 1000; i++) {
68- JSON.stringify({x: i, data: Math.random()});
69- }
70- console.log(JSON.stringify({"status": "pre-warmed"}));
71- `
7257 } ,
7358 typescript : {
7459 executor : "typescript" ,
7560 minSize : 3 ,
7661 maxProcesses : 10 ,
7762 idleTimeout : 5 * 60 * 1000 ,
78- preWarmScript : `
79- const { transformSync } = require('esbuild');
80- const warmupCode = 'interface Test { x: number; } const test: Test = { x: 42 }; test.x';
81- transformSync(warmupCode, { loader: 'ts', target: 'es2020', format: 'cjs' });
82- console.log(JSON.stringify({"status": "pre-warmed"}));
83- `
8463 }
8564} ;
8665
@@ -392,10 +371,6 @@ export class ProcessPoolManager {
392371 const sessionId = `pre-warm-${ executor } -${ i } -${ Date . now ( ) } ` ;
393372 const process = await this . createProcess ( executor , sessionId ) ;
394373
395- if ( config . preWarmScript ) {
396- await this . executePreWarmScript ( process , config . preWarmScript , executor ) ;
397- }
398-
399374 process . isAvailable = true ;
400375 process . sessionId = undefined ;
401376 pool . push ( process ) ;
@@ -409,30 +384,6 @@ export class ProcessPoolManager {
409384 console . log ( `[ProcessPool] Pre-warmed ${ actualCount } /${ config . minSize } ${ executor } processes in ${ warmupTime } ms` ) ;
410385 }
411386
412- private async executePreWarmScript (
413- process : InterpreterProcess ,
414- script : string ,
415- executor : InterpreterLanguage
416- ) : Promise < void > {
417- try {
418- const executionId = `pre-warm-${ Date . now ( ) } ` ;
419- const result = await this . executeCode (
420- process ,
421- script ,
422- executionId ,
423- CONFIG . INTERPRETER_PREWARM_TIMEOUT_MS
424- ) ;
425-
426- if ( result . success ) {
427- console . log ( `[ProcessPool] ${ executor } pre-warm script executed successfully` ) ;
428- } else {
429- console . warn ( `[ProcessPool] ${ executor } pre-warm script failed:` , result . stderr ) ;
430- }
431- } catch ( error ) {
432- console . warn ( `[ProcessPool] ${ executor } pre-warm script error:` , error ) ;
433- }
434- }
435-
436387 private cleanupIdleProcesses ( ) : void {
437388 const now = new Date ( ) ;
438389
0 commit comments