I saw JobQueue's countReadyJobs(Constraint constraint) comment mentioned count as 1 since they cannot be run in parallel, but does exist other way to get job count by specific tag if I set same group id?
e.g have 50 jobs set "A" group id in queue, and have 30 jobs set "B" group id in queue, How can I get 50 by countReadyJobs() method?
/**
* Returns the # of jobs that are waiting to be run
* @return The number of jobs that are waiting in the queue
*/
int count();
/**
* counts the # of jobs that can run now. if there are more jobs from the same group,
* they are count as 1 since they cannot be run in parallel.
* <p>
* Exclude groups are guaranteed to be ordered in natural order.
*
* @param constraint The constraint to match the jobs
*
* @return The number of jobs that are ready to run
*/
int countReadyJobs(@NonNull Constraint constraint);
My example code snippet
public SyncJob() {
super(new Params(1).requireNetwork()
// Make sure that providers can progress in parallel
.groupBy(createTag())
.addTags(createTag())
.setPersistent(persistent)
// To avoid duplicates
.singleInstanceBy());
}
I saw JobQueue's countReadyJobs(Constraint constraint) comment mentioned count as 1 since they cannot be run in parallel, but does exist other way to get job count by specific tag if I set same group id? e.g have 50 jobs set "A" group id in queue, and have 30 jobs set "B" group id in queue, How can I get 50 by countReadyJobs() method?
My example code snippet