remove deprecated advisory lock uniqueness, consolidate insert logic #614
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This removes the original unique jobs implementation in its entirety. It was already deprecated in the previous release.
🗒️ I'm not quite ready to merge this yet (I'd like to get the Ruby + Python clients to ship the new unique jobs changes first) but I still wanted to prepare it while the context is fresh. It's also needed to simplify some upcoming Pro changes.
All known use cases are better supported with the new unique jobs implementation which is also dramatically faster and supports batch insertion.
As part of this change, single insertions now inherit the behavior of batch insertions as far as always setting a
scheduled_at
time in the job args prior to hitting the database. This is due to the difficulty of trying to pass an array of nullable timestamps forscheduled_at
to the database using sqlc. One side effect of this is that some tests needed to be updated because they run in a transaction, which locks in a particularnow()
time used inJobGetAvailble
by default. Jobs inserted after the start of that transaction would pick up a scheduled timestamp from Go code that is later than the database transaction's timestamp, and so those jobs would never run. This was fixed in some cases by allowingnow
to be overridden by lower level callers of that query, whereas other tests were updated to simply insert jobs with a pastscheduled_at
to ensure their visibility.TODO
Currently based on #613.