Skip to content

Guarantee output order in batch insertion example#1206

Merged
brandur merged 1 commit intomasterfrom
brandur-guarantee-insert-order
Apr 13, 2026
Merged

Guarantee output order in batch insertion example#1206
brandur merged 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
@brandur brandur merged commit 9eaea33 into master Apr 13, 2026
15 checks passed
@brandur brandur deleted the brandur-guarantee-insert-order branch April 13, 2026 05:07
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.

2 participants