Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unique job example to be a little more realistic #11

Merged
merged 1 commit into from
Nov 11, 2023

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Nov 11, 2023

As I was writing the docs for unique jobs, I found that I wanted to have
an example that was a little more elaborate than what we already had
which demonstrated the use of uniqueness along multiple properties
instead of just duration.

Here, update the unique opts example so that the job becomes reconciling
a single account that should run every 24 hours, so jobs for account 1
and account 2 are inserted separately, and we show that a duplicate for
account 1 isn't allowed. I suspect that this change makes the example a
little more realistic along the lines of what users will want to do so
it has that benefit in addition to being more conducive for the docs.

@@ -14,44 +14,47 @@ import (
"github.com/riverqueue/river/riverdriver/riverpgxv5"
)

// Account represents a minimal account containing a unique identifier, recent
// expenditures, and a remaining total.
// Account represents a minimal account recent expenditures and remaining total.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo or missing words in here I think? "account recent expenditures"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah dammit. Last second change and of course I messed it up. Thanks, fixed.

As I was writing the docs for unique jobs, I found that I wanted to have
an example that was a little more elaborate than what we already had
which demonstrated the use of uniqueness along multiple properties
instead of just duration.

Here, update the unique opts example so that the job becomes reconciling
a single account that should run every 24 hours, so jobs for account 1
and account 2 are inserted separately, and we show that a duplicate for
account 1 isn't allowed. I suspect that this change makes the example a
little more realistic along the lines of what users will want to do so
it has that benefit in addition to being more conducive for the docs.
@brandur brandur force-pushed the brandur-update-unique-example branch from c99533b to 7cd5ccf Compare November 11, 2023 22:44
@brandur brandur merged commit a9e0090 into master Nov 11, 2023
5 checks passed
@brandur brandur deleted the brandur-update-unique-example branch November 11, 2023 22:46
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