( ctx context.Context, activation taskRoleActivation, )
| 500 | } |
| 501 | |
| 502 | func (r *taskRoleRuntime) startStarvationSession( |
| 503 | ctx context.Context, |
| 504 | activation taskRoleActivation, |
| 505 | ) (*session.Info, error) { |
| 506 | opts, err := taskRoleCreateOpts(activation) |
| 507 | if err != nil { |
| 508 | return nil, err |
| 509 | } |
| 510 | ttlExpiresAt := r.now().UTC().Add(defaultStarvationWorkerTTL) |
| 511 | opts.Lineage = &store.SessionLineage{ |
| 512 | SpawnRole: session.DefaultSpawnRole, |
| 513 | TTLExpiresAt: &ttlExpiresAt, |
| 514 | SpawnBudget: store.SessionSpawnBudget{ |
| 515 | MaxChildren: session.DefaultSpawnMaxChildren, |
| 516 | MaxDepth: session.DefaultSpawnMaxDepth, |
| 517 | TTLSeconds: int64(defaultStarvationWorkerTTL / time.Second), |
| 518 | MaxActivePerWorkspace: defaultStarvationMaxActivePerWorkspace, |
| 519 | }, |
| 520 | } |
| 521 | return r.createRoleSession(ctx, opts) |
| 522 | } |
| 523 | |
| 524 | func taskRoleSessionMatches(info *session.Info, activation taskRoleActivation) bool { |
| 525 | if info == nil { |
no test coverage detected