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

Allow by period uniqueness to be based off scheduled time #734

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

brandur
Copy link
Contributor

@brandur brandur commented Jan 25, 2025

This one attempts to resolve #715. Currently, by period uniqueness
always bases the period off the current time, but there's a good
argument that if the job has been scheduled for a particular time in the
future, it should be based off that time instead.

This is one that could nominally be considered a small breaking change
in a Hyrum's Law sort of way, even though it's really patching what
could be considered a bug. Even though it was sort of broken before,
some apps may have come to depend on the broken behavior of the unique
code ignoring ScheduledAt. I'm not sure that it's a big enough problem
to be worth calling out though, so I didn't.

Fixes #715.

This one attempts to resolve #715. Currently, by period uniqueness
always bases the period off the current time, but there's a good
argument that if the job has been scheduled for a particular time in the
future, it should be based off that time instead.

This is one that could nominally be considered a small breaking change
in a Hyrum's Law sort of way, even though it's really patching what
could be considered a bug. Even though it was sort of broken before,
some apps may have come to depend on the broken behavior of the unique
code ignoring `ScheduledAt`. I'm not sure that it's a big enough problem
to be worth calling out though, so I didn't.

Fixes #715.
@brandur brandur force-pushed the brandur-base-unique-off-scheduled-time branch from b5e67e3 to a672ad3 Compare January 25, 2025 19:48
Copy link
Contributor

@bgentry bgentry left a comment

Choose a reason for hiding this comment

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

Looks good, I agree with your analysis and think it's unlikely to impact anybody in a negative way. This is probably something we'll want to pull over to the Ruby + Python libs too, right?

@brandur
Copy link
Contributor Author

brandur commented Jan 25, 2025

Thanks.

Yes on Ruby and Python. I'll take a crack at those.

@brandur brandur merged commit ee4cbd4 into master Jan 25, 2025
10 checks passed
@brandur brandur deleted the brandur-base-unique-off-scheduled-time branch January 25, 2025 19:59
brandur added a commit to riverqueue/riverqueue-ruby that referenced this pull request Jan 25, 2025
This one follows up [1] in the main repository, in which we fix what
could be considered a bug in that by period uniqueness was always based
off the current time, even though a job may have been given a custom
value for `scheduled_at`, which really should take precedence.

[1] riverqueue/river#734
brandur added a commit to riverqueue/riverqueue-ruby that referenced this pull request Jan 25, 2025
This one follows up [1] in the main repository, in which we fix what
could be considered a bug in that by period uniqueness was always based
off the current time, even though a job may have been given a custom
value for `scheduled_at`, which really should take precedence.

[1] riverqueue/river#734
brandur added a commit to riverqueue/riverqueue-ruby that referenced this pull request Jan 25, 2025
This one follows up [1] in the main repository, in which we fix what
could be considered a bug in that by period uniqueness was always based
off the current time, even though a job may have been given a custom
value for `scheduled_at`, which really should take precedence.

[1] riverqueue/river#734
@bgentry bgentry mentioned this pull request Jan 28, 2025
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.

Scheduled jobs with unique
2 participants