support custom key in queue.enqueue
even when runAt
is not specified
#8
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.
Add support to specify a
key
inside theenqueue
method without specifying therunAt
.Previously when you have called:
The queue entry was created, but without the specified key.
Based on the code, you had to specify the
runAt
, which would also trigger some check/delete logic.With this change, you can now specify the
key
without running the additional checks.My use case is/was the following:
I have a queue to named "quality check". Here I have a scheduled job ( daily base ). Via an user interface I can trigger also a "re-check" for an dedicated record.
I wanted to use the the same queue ( and the script logic ).
Inside the script I planned to use the
key
to decide what I have to do ( run check for all records vs. run it only for one record )Not sure if this is something what you want to implement - if not, feel free to close this PR.
Alternatives solutions:
runAt
propertyI have added a
.env.example
to make it easier for others if they want to contribute :)Via
pnpm with-env pnpm dev
you can run it without getting the error "DATABASE_URL is not defined"