Skip to content

Commit 65bd774

Browse files
committed
Update Dockerfiles to use postgresql16-client and enhance job status handling. Added 'retrying' status to jobs and updated job loading logic to include 'retrying' status.
1 parent 4afcbdb commit 65bd774

File tree

4 files changed

+4
-3
lines changed

4 files changed

+4
-3
lines changed

Dockerfile.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ FROM alpine:latest
2727

2828
# Install runtime dependencies
2929
RUN apk --no-cache add \
30-
postgresql-client \
30+
postgresql16-client \
3131
ca-certificates \
3232
tzdata \
3333
curl \

Dockerfile.worker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ FROM alpine:latest
2727

2828
# Install runtime dependencies
2929
RUN apk --no-cache add \
30-
postgresql-client \
30+
postgresql16-client \
3131
ca-certificates \
3232
tzdata \
3333
&& rm -rf /var/cache/apk/*

internal/database/schema_postgres.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ CREATE TABLE IF NOT EXISTS jobs (
7373
database_name TEXT NOT NULL,
7474
backup_id TEXT,
7575
priority INTEGER NOT NULL DEFAULT 5,
76-
status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'running', 'completed', 'failed', 'cancelled')),
76+
status TEXT NOT NULL DEFAULT 'pending' CHECK(status IN ('pending', 'running', 'completed', 'failed', 'cancelled', 'retrying')),
7777
payload JSONB,
7878
retry_count INTEGER NOT NULL DEFAULT 0,
7979
max_retries INTEGER NOT NULL DEFAULT 3,

internal/worker/queue.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ func (q *JobQueue) loadJobsFromDatabase() {
445445
SELECT id, type, postgres_id, database_name, backup_id, priority, payload, retry_count, max_retries, created_at
446446
FROM jobs
447447
WHERE status = 'pending'
448+
OR status = 'retrying'
448449
OR (status = 'running' AND started_at < NOW() - INTERVAL '5 minutes')
449450
ORDER BY priority DESC, created_at ASC
450451
LIMIT 10

0 commit comments

Comments
 (0)