(pool params.Pool, aditionalLabels []string)
| 1324 | } |
| 1325 | |
| 1326 | func (r *basePoolManager) addRunnerToPool(pool params.Pool, aditionalLabels []string) error { |
| 1327 | if !pool.Enabled { |
| 1328 | return fmt.Errorf("pool %s is disabled", pool.ID) |
| 1329 | } |
| 1330 | |
| 1331 | poolInstanceCount, err := r.store.PoolInstanceCount(r.ctx, pool.ID) |
| 1332 | if err != nil { |
| 1333 | return fmt.Errorf("failed to list pool instances: %w", err) |
| 1334 | } |
| 1335 | |
| 1336 | if poolInstanceCount >= int64(pool.MaxRunners) { |
| 1337 | return fmt.Errorf("max workers (%d) reached for pool %s", pool.MaxRunners, pool.ID) |
| 1338 | } |
| 1339 | |
| 1340 | if err := r.AddRunner(r.ctx, pool.ID, aditionalLabels); err != nil { |
| 1341 | return fmt.Errorf("failed to add new instance for pool %s: %w", pool.ID, err) |
| 1342 | } |
| 1343 | return nil |
| 1344 | } |
| 1345 | |
| 1346 | func (r *basePoolManager) ensureIdleRunnersForOnePool(pool params.Pool) error { |
| 1347 | if !pool.Enabled || pool.MinIdleRunners == 0 { |
no test coverage detected