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

feature-request: It should be possible to predict a job key or id. #419

Open
nuelsoft opened this issue Aug 23, 2023 · 4 comments
Open

feature-request: It should be possible to predict a job key or id. #419

nuelsoft opened this issue Aug 23, 2023 · 4 comments

Comments

@nuelsoft
Copy link

There are cases where an actor would want to replace an already scheduled job. The current solution doesn't allow for this or any kind of job filtering by data jsonb object.

An example use-case

function schedulePendingActionNotificaion(userId: string) {
  const queue = 'pending-actions-notifcation'
  const key = `pending-action::${userId}`
  boss.cancel({name: queue, key})
  boss.send(queue, {userId}, { key })
}

This doesn't have to replace the existing id, It should only another possible reference that can be predicted uniquely

@jorinvo
Copy link

jorinvo commented Aug 29, 2023

It would be sufficient if pg-boss allows passing an id to send() instead of pg-boss generating a uuid.

Without being able to set IDs ourselves, we currently have to maintain a separate table to map IDs.

@timgit
Copy link
Owner

timgit commented Aug 30, 2023

This would be a good option to send(). You can use insert([jobs]) for now, however.

@jorinvo
Copy link

jorinvo commented Aug 30, 2023

Thanks @timgit! insert() does what we need. And thank you for the work on this lib :)

@nuelsoft
Copy link
Author

Hello @timgit, thank you for the pointer. I was more worried by this

id uuid primary key not null default gen_random_uuid(),

It would be nice to maybe drop the type from uuid to a more flexible string.

Thanks again.

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

No branches or pull requests

3 participants