question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add duration property to completed jobs

See original GitHub issue

It would be nice if jobs would track how long they took to execute. If they already do, that’s great, but it wasn’t obvious from the docs or the properties on the job object how they do that.

Suggestion:

//Track high res start time
const startTime = process.hrtime();

//Run job handler
//...do stuff...

//Track high res end time
const endTime = process.hrtime();

//Get duration in MS
const ms = (end[0] - start[0]) * 1e3 + (end[1] - start[1]) * 1e-6;

//Store on completed job
job.duration = ms;

Currently doing this manually, but it would be nice if this was implemented in bullmq internally.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
manastcommented, May 11, 2021

but of course we could add a new sets of properties ending in hr for the high resolution version like onProcessedHr, etc.

0reactions
adamreisnzcommented, May 11, 2021

Yes that would be great. Personally I would also rename the properties to be a bit clearer, as it’s quite confusing if you don’t know BullMQ well. E.g. startedOn, completedOn is clear just from reading it, whereas processedOn could be interpreted in different ways. I realise this would be a breaking change though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change a task duration - Microsoft Support
Change a task duration at any time by using the Duration column. You can also change the duration unit from days to hours,...
Read more >
Job Properties - Documentation for Control-M Automation API ...
Job Properties. Below is a list of job properties for Control-M objects. ... You can add or remove events from the Control-M by...
Read more >
Adding jobs in AWS Glue
AWS Glue triggers can start jobs based on a schedule or event, or on demand. You can monitor job runs to understand runtime...
Read more >
Understanding Task Properties - SkedPal
To schedule a task, you'll need to estimate the time needed to complete the task. The duration chip in the line (task) detail...
Read more >
`.gitlab-ci.yml` keyword reference - GitLab Docs
A blocked pipeline does not run any jobs in later stages until the manual job is started and completes successfully.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found