[go: up one dir, main page]

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

Peeking a job queue? #269

Open
noamgat opened this issue Sep 1, 2021 · 1 comment
Open

Peeking a job queue? #269

noamgat opened this issue Sep 1, 2021 · 1 comment

Comments

@noamgat
Copy link
noamgat commented Sep 1, 2021

Hi,
I'm using PGBoss in a setup that uses external job fulfillers, so I expose a REST API that includes things like getNextJob(queueName) and complete(jobId).
I want to be able to build a monitoring solution on top of this. The monitor should be able to know that no worker has taken a job from a queue, by finding out that the next pending job on the AAA queue was created more than an hour ago.
boss.getQueueSize() gives us the number of projects in the queue, but not how long ago it was created.
fetch() gives me the job information, but also acts as a worker and removes the job from a pending state.

Is there a "peek" option (very common in queues) that allows me to get the information of the next job in a queue, without dequeuing it?

@timgit
Copy link
Owner
timgit commented Sep 1, 2021

There's not a peek() api in pg-boss, so you will need to build this yourself until it exists. Since pg-boss is also a priority queue, the fetch order isn't always creation date if you opt into creating higher priority jobs that can jump to the front of the queue. Keep that in mind if you decide to set this up via a custom SQL solution in the interim of this feature existing.

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

No branches or pull requests

2 participants