-
Notifications
You must be signed in to change notification settings - Fork 440
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
Add job.runAt property to expose timestamp that job is supposed to run at #1732
base: master
Are you sure you want to change the base?
Conversation
Thank you for the PR. |
@manast While that works for jobs that are in the delayed state, it doesn't work for calculating something like a "job wait time" metric, i.e. how long after after a job's runAt that it actually starts running, because there's no timestamp for when a job was enqueued into I don't think storing the job's |
@hyperair could we delete the "delay" field on the job then as it does not seem to be useful? Regarding runAt, I think it could be misleading as it should not represent "when" the job will be run, it represents how much the job will wait at least before it is run, or the timestamp from which it could run, but for different reasons it could run after that, so "processedOn" and "runAt" would not be the same most of the time. |
@hyperair then the other question is, should "runAt" be cleared after the job has been moved from the delayed set to the wait list? |
so in a sense "runAt" would be the same as the score in the delay set, just a cached value that makes it more convenient when getting the jobs. |
Ok, this seems to be quite a niche use-case, since usually you are mostly interested in the total time it took from when the job was added to a queue up to when it was completed 🤔 |
Yep, it'll be an API break, but if you're okay with it I'll drop the
Hmm, that's true. Will one of the following work, or do you have suggestions for a better name?
Nope, the idea is for
In my case I'm generating two timing metrics for this:
A single combined metric summing the above two durations up makes it more difficult to differentiate between these two kinds of problems, but even that's not really possible to generate with bullmq |
As it turns out, there's one purpose for |
This would be a very useful addition for me as I cannot accurately tell when a job will after calling |
Would also love this feature since I use |
@lindesvard I will try to improve it somehow. |
Fixes: #1728