fix: fixes SQLITE not respecting orderby + limit on update#161
Merged
GiovaniGuizzo merged 1 commit intomasterfrom Feb 4, 2026
Merged
fix: fixes SQLITE not respecting orderby + limit on update#161GiovaniGuizzo merged 1 commit intomasterfrom
GiovaniGuizzo merged 1 commit intomasterfrom
Conversation
merencia
approved these changes
Feb 4, 2026
sidequest-release bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
## [1.13.7](v1.13.6...v1.13.7) (2026-02-04) ### Bug Fixes * fixes SQLITE not respecting orderby + limit on update ([#161](#161)) ([6a15dec](6a15dec))
sidequest-release bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
## [1.13.7](v1.13.6...v1.13.7) (2026-02-04) ### Bug Fixes * fixes SQLITE not respecting orderby + limit on update ([#161](#161)) ([6a15dec](6a15dec))
sidequest-release bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
## [1.13.7](v1.13.6...v1.13.7) (2026-02-04) ### Bug Fixes * fixes SQLITE not respecting orderby + limit on update ([#161](#161)) ([6a15dec](6a15dec))
sidequest-release bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
## [1.13.7](v1.13.6...v1.13.7) (2026-02-04) ### Bug Fixes * fixes SQLITE not respecting orderby + limit on update ([#161](#161)) ([6a15dec](6a15dec))
sidequest-release bot
pushed a commit
that referenced
this pull request
Feb 4, 2026
## [1.13.7](v1.13.6...v1.13.7) (2026-02-04) ### Bug Fixes * fixes SQLITE not respecting orderby + limit on update ([#161](#161)) ([6a15dec](6a15dec))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist for Pull Requests
yarn test:allandyarn test:integration)Summary of Changes
Closes #159
Apparently, SQLite does not respect updates with order by and limit. For it do be able to do so, one must enable
SQLITE_ENABLE_UPDATE_DELETE_LIMITduring compilation time. For what is worth, better-sqlite3 has this option enabled, but it doesn't work.I have added a very important missing test case where we assert whether
claimPendingJobclaims only the quantity passed. It works on all dbs, except SQLite. I tried using both sqlite3 and better-sqlite3, none worked.An alternative solution would be for us to compile our own version of SQLite, but I'd rather not.
This solution that I cam up with is not perfect, but it gets the job done. We first select the jobs to update, then update them in a second instruction. In a race condition, we might have a job being claimed by two different workers, but I kept the
status = waitingclause in the query to avoid that race condition.