You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have some jobs that have ENABLED=0 and the jobs are still being ran. Checking the code, I don't see where the ENABLED parameter is being checked before execution. Since our jobs are read from a MySQL database, I can easily filter out any with ENABLED=0 but I just wanted to confirm if this was an issue or if I was missing something here.
Hi. Thanks for replying. I was just following the code from when i issue $jobby->run(); Based on the example in jobby-pdo.php.
I don't see where it calls shouldRun() or does any $config['enabled'] check. Should I be using a different class other than $jobby = new \Jobby\Jobby(); ?
\Jobby\Jobby::run() defers to \Jobby\Jobby::runUnix(). I cannot find where this parameters is checked in any of that.
I was capitalizing as a way of focusing on the issue, not literally in the code. Consider the following example from the jobby-pdo.php example file:
$jobbiesStmt = $dbh->query("SELECT * FROM $dbhJobbiesTableName");
$jobbies = $jobbiesStmt->fetchAll(PDO::FETCH_ASSOC);
$jobby = new \Jobby\Jobby();
foreach ($jobbies as $job) {
// Filter out each value, which is not set (for example, "maxRuntime" is not defined in the job).
$job = array_filter($job);
try {
$job['closure'] = $serializer->unserialize($job['command']);
unset($job['command']);
} catch (SuperClosure\Exception\ClosureUnserializationException $e) {
}
$jobName = $job['name'];
unset($job['name']);
$jobby->add($jobName, $job);
}
$jobby->run();
I had to change the select to:
$jobbiesStmt = $dbh->query("SELECT * FROM $dbhJobbiesTableName WHERE enabled = 1");
in order to keep disabled tasks from running, as it would seem that the enabled flag was not being checked properly elsewhere.
Activity
hellogerard commentedon Feb 13, 2018
No, it should work. The line is here:
jobby/src/BackgroundJob.php
Line 199 in 44694c1
BillBuilt commentedon Feb 13, 2018
Hi. Thanks for replying. I was just following the code from when i issue $jobby->run(); Based on the example in jobby-pdo.php.
I don't see where it calls shouldRun() or does any $config['enabled'] check. Should I be using a different class other than $jobby = new \Jobby\Jobby(); ?
\Jobby\Jobby::run() defers to \Jobby\Jobby::runUnix(). I cannot find where this parameters is checked in any of that.
Thanks again!
BillBuilt commentedon Mar 15, 2018
I was capitalizing as a way of focusing on the issue, not literally in the code. Consider the following example from the jobby-pdo.php example file:
$jobbiesStmt = $dbh->query("SELECT * FROM
$dbhJobbiesTableName");$jobbies = $jobbiesStmt->fetchAll(PDO::FETCH_ASSOC);
$jobby = new \Jobby\Jobby();
foreach ($jobbies as $job) {
// Filter out each value, which is not set (for example, "maxRuntime" is not defined in the job).
$job = array_filter($job);
try {
$job['closure'] = $serializer->unserialize($job['command']);
unset($job['command']);
} catch (SuperClosure\Exception\ClosureUnserializationException $e) {
}
$jobName = $job['name'];
unset($job['name']);
$jobby->add($jobName, $job);
}
$jobby->run();
I had to change the select to:
$jobbiesStmt = $dbh->query("SELECT * FROM
$dbhJobbiesTableNameWHEREenabled= 1");in order to keep disabled tasks from running, as it would seem that the enabled flag was not being checked properly elsewhere.