from concurrent.futures import ThreadPoolExecutor IO_POOL_MAX_WORKERS: int = 4 IO_POOL_THREAD_NAME_PREFIX: str = "controller-io" def make_io_pool(max_workers: int = IO_POOL_MAX_WORKERS) -> ThreadPoolExecutor: """Create the shared AppController I/O pool. 4 worker threads, named "controller-io-N". Used for warmup, log pruning, disk-bound subsystem init, and any other background work that should not spin up its own thread. Caller is responsible for shutdown (e.g. controller.shutdown()). """ return ThreadPoolExecutor( max_workers=max_workers, thread_name_prefix=IO_POOL_THREAD_NAME_PREFIX, )