Conversation
A worker prefix such as mail_* became LIKE 'mail_%', so _ and % matched any character. When that false match was the only row, the selector returned it without the literal prefix check and the worker claimed a queue it was not configured to run.
ESCAPE '\' is a valid string on SQLite and PostgreSQL, but MySQL treats the backslash as an escape and rejects the clause. MySQL needs the same one-character escape written as '\\'.
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.
What
QueueSelectorturns a worker prefix such asmail_*into a SQLLIKEpattern._and%in that prefix were left unescaped, soLIKE 'mail_%'also matchedmailboxormail-ops.*is still the only wildcard.When that false match was the only row,
in_raw_orderreturned it immediately becausequeues.one?skipped the literalstart_with?filter. The worker then claimed jobs from a queue it was not configured to run.Why
_and%are escaped (viasanitize_sql_like) before*is replaced with%, and theLIKEclause setsESCAPE '\'so the escape works on SQLite as well as MySQL and PostgreSQL. Prefix matches always go through the literal filter, including when only one name comes back, so a falseLIKEhit is not claimed.A regression test covers a prefix that is the only
LIKEhit but not a literal match, and a realmail_*/100%_*queue that should still be claimed.