batch-cluster
    Preparing search index...

    Interface ChildProcessFactory

    These are required parameters for a given BatchCluster.

    interface ChildProcessFactory {
        processFactory: () => ChildProcess | Promise<ChildProcess>;
    }
    Index

    Properties

    Properties

    processFactory: () => ChildProcess | Promise<ChildProcess>

    Factory function to spawn child processes.

    CRITICAL: If you spawn a child process and then reject the promise, YOU are responsible for killing the spawned process. BatchCluster cannot track processes that were never returned.

    Safe pattern:

    async function myFactory(): Promise<ChildProcess> {
    const proc = spawn("my-command", args);
    try {
    await someValidation(proc);
    return proc;
    } catch (error) {
    proc.kill(); // REQUIRED: Clean up before rejecting!
    throw error;
    }
    }

    Unsafe pattern (LEAKS PROCESSES):

    async function leakyFactory(): Promise<ChildProcess> {
    const proc = spawn("my-command", args);
    await someValidation(proc); // If this throws, proc is orphaned!
    return proc;
    }