Skip to content

Guarantee output order in batch insertion example#1206

Open
brandur wants to merge 1 commit intomasterfrom
brandur-guarantee-insert-order
Open

Guarantee output order in batch insertion example#1206
brandur wants to merge 1 commit intomasterfrom
brandur-guarantee-insert-order

Conversation

@brandur
Copy link
Copy Markdown
Contributor

@brandur brandur commented Apr 12, 2026

Aims to fix an intermittently failing example wherein we can print an
"Inserted ..." message after the work messages coming from each inserted
job.

https://github.com/riverqueue/river/actions/runs/24310710305/job/70979718727

--- FAIL: Example_batchInsert (0.09s)
got:
Worked a job
Worked a job
Worked a job
Worked a job
Worked a job
Inserted 5 jobs
want:
Inserted 5 jobs
Worked a job
Worked a job
Worked a job
Worked a job
Worked a job
FAIL
FAIL	github.com/riverqueue/river	26.753s

The fix is pretty straightforward in making sure we do the inserts
(and therefore print the right message) before starting the client and
introducing the possibility that jobs can be worked.

Aims to fix an intermittently failing example wherein we can print an
"Inserted ..." message after the work messages coming from each inserted
job.

https://github.com/riverqueue/river/actions/runs/24310710305/job/70979718727

    --- FAIL: Example_batchInsert (0.09s)
    got:
    Worked a job
    Worked a job
    Worked a job
    Worked a job
    Worked a job
    Inserted 5 jobs
    want:
    Inserted 5 jobs
    Worked a job
    Worked a job
    Worked a job
    Worked a job
    Worked a job
    FAIL
    FAIL	github.com/riverqueue/river	26.753s

The fix is pretty straightforward in making sure we do the inserts
(and therefore print the right message) before starting the client and
introducing the possibility that jobs can be worked.
@brandur brandur requested a review from bgentry April 12, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant