()
| 271 | } |
| 272 | |
| 273 | func (r *basePoolManager) GetGithubRunners() ([]forgeRunner, error) { |
| 274 | // Gitea has no scale sets API |
| 275 | if r.scaleSetClient == nil { |
| 276 | return r.listRunnersWithPagination() |
| 277 | } |
| 278 | |
| 279 | // try the scale sets API for github |
| 280 | runners, err := r.listRunnersWithScaleSetAPI() |
| 281 | if err != nil { |
| 282 | slog.WarnContext(r.ctx, "failed to list runners via scaleset API; falling back to pagination", "error", err) |
| 283 | return r.listRunnersWithPagination() |
| 284 | } |
| 285 | |
| 286 | entityInstances := cache.GetEntityInstances(r.entity.ID) |
| 287 | if len(entityInstances) > 0 && len(runners) == 0 { |
| 288 | // I have trust issues in the undocumented API. We seem to have runners for this |
| 289 | // entity, but the scaleset API returned nothing and no error. Fall back to pagination. |
| 290 | slog.DebugContext(r.ctx, "the scaleset api returned nothing, but we seem to have runners in the db; falling back to paginated API runner list") |
| 291 | return r.listRunnersWithPagination() |
| 292 | } |
| 293 | slog.DebugContext(r.ctx, "Scaleset API runner list succeeded", "runners", runners) |
| 294 | return runners, nil |
| 295 | } |
no test coverage detected