Fix AI job claim returning columns
This commit is contained in:
@@ -26,6 +26,13 @@ scheduled_at, started_at, completed_at, worker_id, heartbeat_at,
|
|||||||
created_at, updated_at, idempotency_key
|
created_at, updated_at, idempotency_key
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const jobSelectColumnsFromJobAlias = `
|
||||||
|
j.id, j.owner_service, j.owner_ref, j.task_type, j.model_profile, j.priority, j.status,
|
||||||
|
j.attempts, j.max_attempts, j.input, j.result, j.error_code, j.error_message,
|
||||||
|
j.scheduled_at, j.started_at, j.completed_at, j.worker_id, j.heartbeat_at,
|
||||||
|
j.created_at, j.updated_at, j.idempotency_key
|
||||||
|
`
|
||||||
|
|
||||||
func Open(ctx context.Context, databaseURL string) (*Store, error) {
|
func Open(ctx context.Context, databaseURL string) (*Store, error) {
|
||||||
if strings.TrimSpace(databaseURL) == "" {
|
if strings.TrimSpace(databaseURL) == "" {
|
||||||
return nil, errors.New("DATABASE_URL is required")
|
return nil, errors.New("DATABASE_URL is required")
|
||||||
@@ -339,7 +346,7 @@ SET status = 'running',
|
|||||||
updated_at = NOW()
|
updated_at = NOW()
|
||||||
FROM picked
|
FROM picked
|
||||||
WHERE j.id = picked.id
|
WHERE j.id = picked.id
|
||||||
RETURNING ` + jobSelectColumns + `
|
RETURNING ` + jobSelectColumnsFromJobAlias + `
|
||||||
`
|
`
|
||||||
rows, err := s.pool.Query(ctx, q, in.TaskTypes, in.ModelProfiles, in.Limit, workerID)
|
rows, err := s.pool.Query(ctx, q, in.TaskTypes, in.ModelProfiles, in.Limit, workerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user