-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
feature request: worker's job filter #409
Comments
You can already do this using wildcards. Set all workers to a wildcard by default, such as |
Sorry, I don't get it. My target would be having a silly producer that does not know how many consumers the BE has |
For example, a producer would use the flavor as part of the queue name, such as |
The proposed solution assumes that I have control over the producer - it is not the case 😞 |
Would you mind to accept a PR with such a feature in case? |
Yes, sounds good |
This would be useful. I didn't see a test case for |
Since wildcards have been dropped in v10, my original response is no longer valid. The most feasible option seems to be some sort of additional opt-in filter like originally proposed. The primary issue in using the data payload is fetch performance, since the data column is not indexed. I don't think indexing data is a good idea globally, since the payload could be large, and this would impact write performance as well. However, this doesn't mean it's a deal-breaker. Now that queues are isolated via partitioning, this opens up the possibility of a diversity of indexing strategies since indexes in queue A wouldn't have to match indexes in queue B. One way to pull this off would be add a new option in |
In order to create a QOS system it would be great to support a
filter
option by thework()
method.This new parameter lets the user to write to a single queue/table and 2 different workers will be able to process the same queue at different pace:
icecream
icecream
with jobtaste: cioco
has a worker that process it withnewJobCheckInterval: 200
icecream
with jobtaste: bubble
has a worker that process it withnewJobCheckInterval: 2000
❗️ It is up to the user writing a filter that process all the jobs, otherwise the job with
taste: lemon
will be archived automatically.Example:
This should generate a query like this in the fetch function:
pg-boss/src/plans.js
Line 353 in 523c36b
WITH nextJob as ( SELECT id FROM pgboss.job j WHERE state < 'active' AND name LIKE $1 AND startAfter < now() + AND data ->> 'body' = $3 ORDER BY priority desc, createdOn, id LIMIT $2 FOR UPDATE SKIP LOCKED ) UPDATE pgboss.job j SET state = 'active', startedOn = now(), retryCount = CASE WHEN state = 'retry' THEN retryCount + 1 ELSE retryCount END FROM nextJob WHERE j.id = nextJob.id RETURNING j.id, name, data, EXTRACT(epoch FROM expireIn) as expire_in_seconds
Note:
executeSql
function when the user customizes thedb
tooWhat do you think?
The text was updated successfully, but these errors were encountered: