forked from mtusi2026/mtusi2026lab5
lab5
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
: "${ATTACHMENT_ID:?Set ATTACHMENT_ID to the failed attachment UUID}"
|
||||
|
||||
# Explicit operator action: only a failed job is moved back to the durable queue.
|
||||
docker compose --env-file .env exec -T postgres psql -U "${POSTGRES_USER:-messenger}" -d "${POSTGRES_DB:-messenger}" -v ON_ERROR_STOP=1 \
|
||||
-v attachment_id="$ATTACHMENT_ID" <<'SQL'
|
||||
UPDATE attachment_jobs
|
||||
SET status = 'queued', attempt = 0, next_attempt_at = now(), lease_until = NULL,
|
||||
published_at = NULL, error_code = NULL, updated_at = now()
|
||||
WHERE attachment_id = :'attachment_id' AND status = 'failed';
|
||||
UPDATE attachments
|
||||
SET status = 'queued', error_code = NULL, updated_at = now()
|
||||
WHERE id = :'attachment_id' AND status = 'failed';
|
||||
SQL
|
||||
Reference in New Issue
Block a user