feat(worker): process attachments with thumbnails and bounded retries
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user