Hi!
Normally we schedule our jobs using BackgroundJob.Enqueue(methodCall) to a specific queue. One of those jobs should have a delay before being executed - so we used BackgroundJob.Schedule(methodCall, delay). However, it looks like such jobs are not scheduled for a specific queue, it looks like any worker process will happily try to execute the job as soon as the delay has passed. That's a problem for us, as not any worker has loaded the necessary DLLs to execute the job, therefore, the job often fails! Is there a way to make sure that the job is only given to specific types of workers - i.e., the workers attached to the queue we scheduled the job on?
My guess is, that BackgroundJob.Schedule doesn't schedule a job for a specific queue by default. How to configure it so that the job is scheduled for the given queue?
Best regards,
D.R.
OK, it looks like the other workers are not trying to execute the job, they are only trying to move the job from scheduled to enqueued - however, they still need all the DLLs required for that job for doing this...
...is there a way to stop workers from trying to move scheduled jobs to the enqueued state? So that only our "server" is trying to do that? Any other workaround?
We looked a bit into the code, and it looks like BackgroundJobServer "hardcoded" starts a DelayedJobScheduler and we cannot disable it in any way. Would you accept a PR that makes BackgroundJobServer.GetRequiredServices() virtual and would allow us to disable the DelayedJobScheduler?
Then we could use a derived BackgroundJobServer in all workers which are not having references to all the other worker assemblies and run only a specific worker with a DelayedJobScheduler.
Also: how long would it take for a PR to be accepted and released?
i also have same problem. i find DelayedJobScheduler enqueue is not special queueName so it also is "Default"
@odinserj Is this issue tracker alive? Should we instead post on some mailing list? Maybe I don't know how to correctly contact you guys.
Need this! We've just hit this issue... how far away is a fix?
@christogav : Unfortunately, it looks like the project is not actively maintained. I've never heard back from them, most issues just sit there and rot :-(
Is #1247 the fix for this? Appears related.
Our team also need this. Pls fix
Most helpful comment
We looked a bit into the code, and it looks like BackgroundJobServer "hardcoded" starts a DelayedJobScheduler and we cannot disable it in any way. Would you accept a PR that makes
BackgroundJobServer.GetRequiredServices()virtual and would allow us to disable theDelayedJobScheduler?Then we could use a derived BackgroundJobServer in all workers which are not having references to all the other worker assemblies and run only a specific worker with a DelayedJobScheduler.
Also: how long would it take for a PR to be accepted and released?