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

Check status by class name #387

Open
nicdnepr opened this issue Jun 21, 2020 · 5 comments
Open

Check status by class name #387

nicdnepr opened this issue Jun 21, 2020 · 5 comments
Labels
type:enhancement Enhancement

Comments

@nicdnepr
Copy link

From docs - to see status need pass job id

if (!Yii::$app->queue->isDone($id))
echo 'working...'

What about check status by class name?
For example Yii::$app->queue->isAnyWorking(testJob::class) which mean- is any not done job for class TestJob?

@samdark
Copy link
Member

samdark commented Jun 22, 2020

What is the use case for it?

@nicdnepr
Copy link
Author

nicdnepr commented Jun 23, 2020

For example-I need add many users to system
I create 10 queue jobs, then from frontend I check
if (Yii::$app->queue->isAnyWorking(testJob::class)) then echo 'add in progress'
Now I need save all ids and then in loop check

foreach ($idList as $id) {
    if (Yii::$app->queue->isWaiting($id) || Yii::$app->queue->isReserved($id)) {
        echo 'working...'
         break;
    }
}

@samdark
Copy link
Member

samdark commented Jun 23, 2020

OK. That may be useful.

@rob006
Copy link

rob006 commented Jun 23, 2020

Any idea how do you want to implement it? Most of backends does not allow to filter by anything except job ID, so the only way to do this would be to log IDs of jobs and query each of them separately. Exactly in the same way as you're doing it now.

@samdark
Copy link
Member

samdark commented Jun 23, 2020

Yes. With the current info stored it is exactly how @rob006 suggests it.

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

No branches or pull requests

3 participants