feat(worker): process attachments with thumbnails and bounded retries

This commit is contained in:
kk10
2026-11-15 16:50:27 +03:00
parent 8b0ab5440d
commit 19152e7d18
15 changed files with 994 additions and 50 deletions
+3 -12
View File
@@ -72,29 +72,20 @@ UPDATE attachments
SET status = 'ready',
error_code = NULL,
lease_until = NULL,
width = $1::int,
height = $2::int,
updated_at = now()
WHERE id = $3::uuid
WHERE id = $1::uuid
AND status = 'processing'
AND attempts = $4::int
AND attempts = $2::int
AND lease_until > now()
`
type CompleteAttachmentJobParams struct {
Width int
Height int
ID uuid.UUID
Attempt int
}
func (q *Queries) CompleteAttachmentJob(ctx context.Context, arg CompleteAttachmentJobParams) (int64, error) {
result, err := q.db.Exec(ctx, completeAttachmentJob,
arg.Width,
arg.Height,
arg.ID,
arg.Attempt,
)
result, err := q.db.Exec(ctx, completeAttachmentJob, arg.ID, arg.Attempt)
if err != nil {
return 0, err
}