-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Labels
Description
I want to clear queued jobs. I tried this:
$queued_jobs = Resque\Redis::instance()->lrange('queue:eaisto', 0, -1);
if (!empty($queued_jobs) && count($queued_jobs) >= MAX_QUEUE_COUNT) {
foreach ($queued_jobs as $job) {
$payload = json_decode($job, true);
if (!empty($payload['id'])) {
$job_object = Resque\Job::load($payload['id']);
$job_object->cancel();
}
}
}
But this code copied jobs to cancel only. List of queued jobs didn't cleared:
Eaisto queue queued jobs:
1. {"id":"cb6ecf0c16157704296a99","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
2. {"id":"cb6ecf0c161577043cf94b","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
3. {"id":"cb6ecf0c161577044d4dea","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
Eaisto queue cancelled jobs:
1. {"id":"cb6ecf0c161577044d4dea","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
2. {"id":"cb6ecf0c161577043cf94b","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
3. {"id":"cb6ecf0c16157704296a99","class":"GibddJob","data":["\u0415953\u0421\u041073",false]}
What is wrong with this code? How I can clear a list of queued jobs? (not from running job)