Member Junction
    Preparing search index...

    Service for executing JavaScript code in a secure sandbox

    This service manages a pool of worker processes that execute code with full isolation. If a worker crashes due to catastrophic errors, it's automatically restarted without affecting the main application or other workers.

    Index

    Constructors

    Methods

    • Execute JavaScript code in a sandboxed environment

      The code runs in a worker process with full isolation. If the worker crashes due to catastrophic errors, it will be automatically restarted without affecting this call or the main application.

      Parameters

      Returns Promise<CodeExecutionResult>

      Execution result with output, logs, or error

    • Get worker pool statistics

      Returns {
          activeWorkers: number;
          busyWorkers: number;
          queueLength: number;
          totalWorkers: number;
      }

      Pool statistics including worker count and queue length

    • Initialize the service and worker pool

      This must be called before executing any code. It starts the worker processes and waits for them to be ready.

      Returns Promise<void>

    • Shutdown the service and all worker processes

      This should be called during application shutdown to gracefully terminate all workers and reject any pending requests.

      Returns Promise<void>