| 171 | } |
| 172 | |
| 173 | // preboundSocket is a Unix socket pre-bound at startup while the socket |
| 174 | // directory is verified writable. This avoids EROFS errors that can occur |
| 175 | // later under systemd's ProtectSystem=strict when the RuntimeDirectory |
| 176 | // bind mount goes read-only. |
| 177 | type preboundSocket struct { |
| 178 | socketPath string |
| 179 | listener net.Listener |
| 180 | } |
| 181 | |
| 182 | type FlightWorkerPool struct { |
| 183 | mu sync.RWMutex |
| 184 | workers map[int]*ManagedWorker |
| 185 | nextWorkerID int // auto-incrementing worker ID |
| 186 | spawning int // number of workers currently being spawned (not yet in workers map) |
| 187 | socketDir string |
| 188 | fallbackSocketDir string // set lazily when socketDir is EROFS; empty means use primary |
| 189 | configPath string |
| 190 | binaryPath string |
| 191 | maxWorkers int // 0 = unlimited; caps the number of live worker processes |
| 192 | minWorkers int // minimum number of workers to keep alive |
| 193 | idleTimeout time.Duration // how long to keep an idle worker alive |
| 194 | retireOnSessionEnd bool // when true, retire a worker as soon as its last session ends |
| 195 | shuttingDown bool |
| 196 | shutdownCh chan struct{} // closed by ShutdownAll to stop idle reaper |
| 197 |
nothing calls this directly
no outgoing calls
no test coverage detected