feat(worker): lab6 record job outcomes and end-to-end readiness latency

This commit is contained in:
Голиков Maximillian Антон
2026-11-16 21:55:01 +03:00
parent 6558fb5497
commit 44c755f00c
4 changed files with 105 additions and 20 deletions
@@ -200,10 +200,10 @@ func (r *AttachmentRepo) ClaimForProcessing(ctx context.Context, id string, vers
UPDATE attachments
SET status = 'processing', locked_until = now() + $2, updated_at = now(), attempts = attempts + 1
WHERE id = $1::uuid AND status = 'queued' AND pipeline_version = $3
RETURNING id, chat_id, staging_key, pipeline_version, object_key, content_type, attempts
RETURNING id, chat_id, staging_key, pipeline_version, object_key, content_type, attempts, created_at
`
var a domain.Attachment
err := r.pool.QueryRow(ctx, q, id, lease, version).Scan(&a.ID, &a.ChatID, &a.StagingKey, &a.PipelineVersion, &a.ObjectKey, &a.ContentType, &a.Attempts)
err := r.pool.QueryRow(ctx, q, id, lease, version).Scan(&a.ID, &a.ChatID, &a.StagingKey, &a.PipelineVersion, &a.ObjectKey, &a.ContentType, &a.Attempts, &a.CreatedAt)
if err != nil {
if err == pgx.ErrNoRows {
return nil, nil