Skip to content
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

Include the status of a job in the object #2427

Open
BjoernRave opened this issue Feb 15, 2024 · 1 comment
Open

Include the status of a job in the object #2427

BjoernRave opened this issue Feb 15, 2024 · 1 comment

Comments

@BjoernRave
Copy link

BjoernRave commented Feb 15, 2024

I want to build an overview of all the jobs.

I am using this code for that:

import { queue } from "../queue/queue"

const jobs = await queue.getJobs([
      "active",
      "waiting",
      "delayed",
      "completed",
      "failed",
      "paused",
      "prioritized",
      "repeat",
      "wait",
      "waiting",
      "waiting-children",
    ])

It would be nice to add the status of the job to the objects returned by this function, currently I need to get this info by checking what values are available on the Job object

@ivnnv
Copy link

ivnnv commented Feb 21, 2024

just a workaround you could use:
you can iterate thru the different status methods (queue.getActiveJobs(), getWaitingJobs()etc ) to get the jobs grouped by status (then you can join after if needed).
Anyway plain getJobs is not the best idea if you have thousands or millions of jobs because you would need to paginate if you really want to get all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants