Skip to content

Commit 774ae63

Browse files
committed
fix test, update readme
1 parent e14a0c2 commit 774ae63

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,14 @@ QUEUER_DB_SCHEMA=public
6767

6868
You can find a full example (the same as above plus a more detailed example) in the example folder. In there you'll also find a docker-compose file with the timescaleDB/postgres service that is needed for the running the queuer (it's just postgres with an extension).
6969

70+
### Automatic Parent-Child Job Tracking
71+
72+
If you add a new job *from within* the execution of an existing job, the `queuer` automatically tracks this relationship. By leveraging Go's native `context.Context` propagation (e.g., using `q.WithContext(ctx)`), the new job will seamlessly inherit the `parent_rid` of the currently executing job. This enables you to create deep, scalable trees of sub-jobs cleanly, without having to manually pass job IDs around in your function parameters.
73+
74+
### Database Stability & Timeouts
75+
76+
The queuer is built for robust, uninterrupted long-term polling and can seamlessly handle PostgreSQL connection drops or cursor interruptions. We enforce a strict `connect_timeout` (10s) and query `statement_timeout` (30s) at the connection layer to prevent workers from hanging indefinitely on blocking calls. Furthermore, our iterative fetches and polling loops are wrapped in comprehensive error checking. If the database crashes or becomes temporarily unavailable, the queuer will gracefully wait and reconnect rather than crashing the worker thread.
77+
7078
---
7179

7280
## NewQueuer

queuerJob_test.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,8 @@ func TestAddJobRunning(t *testing.T) {
142142
job, err := testQueuer.AddJobWithOptions(options, TaskMock, nil, 1, "2")
143143
require.NoError(t, err, "AddJob should not return an error on success")
144144

145-
queuedJob, err := testQueuer.GetJob(job.RID)
146-
require.NoError(t, err, "GetJob should not return an error")
147-
require.NotNil(t, queuedJob, "GetJob should return the scheduled job")
148-
assert.Equal(t, model.JobStatusScheduled, queuedJob.Status, "Job should be in Scheduled status")
145+
require.NotNil(t, job, "AddJob should return a job")
146+
assert.Equal(t, model.JobStatusScheduled, job.Status, "Job should be in Scheduled status")
149147

150148
job = testQueuer.WaitForJobFinished(job.RID, 5*time.Second)
151149
assert.NotNil(t, job, "WaitForJobFinished should return the finished job")

0 commit comments

Comments
 (0)