You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: implement persistent job queue with bbolt and maintenance worker
The current job queue was volatile and jobs would be lost on backend restarts.
This implements a bbolt-based persistent queue that stores jobs to disk and
restores them on startup. Also added a cron-based maintenance worker that
automatically cleans up old completed and failed job logs to prevent unbounded
disk usage. All existing functionality is preserved and the new features are
fully configurable via environment variables.
Resolves#367
Copy file name to clipboardExpand all lines: backend/README.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,6 +23,11 @@
23
23
# Else if using npm
24
24
FRONTEND_ORIGIN_DEV="http://localhost:5173"
25
25
CONTAINER_ORIGIN="http://localhost:8080/"
26
+
27
+
# Job Queue Configuration (Optional)
28
+
CLEANUP_CRON_SCHEDULE="0 0 * * *"
29
+
CLEANUP_RETENTION_DAYS="7"
30
+
QUEUE_DB_PATH="/app/data/queue.db"
26
31
```
27
32
28
33
Common pitfall: use the value
@@ -57,6 +62,28 @@
57
62
If you are running the backend via Docker, the exposed ports are determined by the compose configuration. To use a different port in a Docker environment, you must manually update the docker-compose.yml file to adjust the container’s port mapping.
58
63
Also, if you change `CCSYNC_PORT`, remember to update `CONTAINER_ORIGIN` accordingly.
59
64
65
+
## Persistent Job Queue
66
+
67
+
The backend includes a persistent job queue system that ensures task operations survive server restarts and provides automatic cleanup of old job logs.
68
+
69
+
### Features
70
+
71
+
-**Persistence**: Jobs are stored in a bbolt database and survive backend restarts
72
+
-**Automatic Cleanup**: Old completed and failed job logs are automatically cleaned up
73
+
-**Configurable**: Cleanup schedule and retention period can be customized
74
+
75
+
### Configuration
76
+
77
+
The job queue system uses the following environment variables:
78
+
79
+
-`CLEANUP_CRON_SCHEDULE`: Cron schedule for cleanup job (default: "0 0 * * *" - daily at midnight)
80
+
-`CLEANUP_RETENTION_DAYS`: Number of days to keep job logs (default: 7)
81
+
-`QUEUE_DB_PATH`: Path to the queue database file (default: "/app/data/queue.db")
82
+
83
+
### Database Location
84
+
85
+
The queue database is stored at `/app/data/queue.db` inside the container, which is mounted to `./backend/data/queue.db` on the host system via Docker volume.
0 commit comments