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

Question: Is there a way to check if a job is in the queue? #264

Closed
hons82 opened this issue Oct 9, 2019 · 3 comments · Fixed by #277
Closed

Question: Is there a way to check if a job is in the queue? #264

hons82 opened this issue Oct 9, 2019 · 3 comments · Fixed by #277

Comments

@hons82
Copy link

hons82 commented Oct 9, 2019

I'm using already the concurrency settings to ensure that only one job of a certain type is running.
What I'd need is to check if the job is already in the queue to show in the UI that there is no need to launch it again, but just wait for the job to finish

@lucas34
Copy link
Owner

lucas34 commented Oct 9, 2019

Hi,
JobBuilder.singleInstance() have 3 parameters. The latest one includeExecutingJob If set to true will also count the job that is current executing.

So I suggest you schedule with

.singleInstance(forId: "", override = false, includeExecutingJob = true)

If the current job is already running this new task will be rejected.

@hons82
Copy link
Author

hons82 commented Oct 11, 2019

I'm using that already, and it's perfect.
However, in my use case I have a list of items that the user can download (serial, not parallel).
Once he clicks on an item I'm adding it to the queue so that it will be downloaded eventually.
Now in that UI I just wanna show that it is in the queue... so re-adding it is not a real option

@lucas34
Copy link
Owner

lucas34 commented Oct 12, 2019

Got it. Right now it's not possible to check the queue prior scheduling event.
This could be added

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

Successfully merging a pull request may close this issue.

2 participants