Ensure queue name is added into dynamic job when adding recurring job using AddOrUpdateDynamic and using queue parameter #2
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.
As noted in this issue 2259 when using
AddOrUpdateDynamic
to add a recurring job using DynamicJobs and setting thequeue
name via the parameter as recommended, the job does not run on the queue unless the Queue attribute is included in the job class/method or the Queue is set in theDynamicRecurringJobOptions
.The above will run on the default queue.
This appears to be caused by when the DynamicJob is created it is not indicating which job to run on in the FromExpression, ie.
return Job.FromExpression(() => DynamicJob.Execute(dynamicJob, default));
so it runs on the default queue unless one of the other ways to set the queue is used.This changes the ToDynamicJob method so it will create the job to run and include the queue name so the dynamic job will run on the desired queue if it is set in the job.