Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Entity/JobRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function resetAll($workerName)
* @param $state
* @return mixed
*/
public function count($workerName, $state)
public function countJobs($workerName, $state)
{
$dbal = $this->getEntityManager()->getConnection();

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ScandioJobQueueBundle
=====================

A Symfony2 queue system.
A Symfony queue system.

With this bundle, you can send commands to a queue, which will be performed according to the crontab.

Expand Down Expand Up @@ -44,7 +44,7 @@ Or if you want to clone the repos:
### Crontab
Just include the Scandio\JobQueueBundle\ScandioJobQueueBundle() in your AppKernel.php and activate it with the following crontab:
```
* * * * * php /var/www/project/app/console scandio:job-queue:worker --maxJobs="250" # runs every minute
* * * * * php /var/www/project/bin/console scandio:job-queue:worker --maxJobs="250" # runs every minute
```

If you want to use more than one worker, add the following lines to the app/config/config.yml:
Expand All @@ -56,10 +56,10 @@ scandio_job_queue:

Add all workers to the crontab:
```
* * * * * php /var/www/project/app/console scandio:job-queue:worker --maxJobs="250" # runs every minute # default is always used!
* * * * * php /var/www/project/app/console scandio:job-queue:worker --maxJobs="250" "load_balance_first"
* * * * * php /var/www/project/app/console scandio:job-queue:worker --maxJobs="250" "load_balance_second"
* * * * * php /var/www/project/app/console scandio:job-queue:worker --maxJobs="250" "load_balance_third"
* * * * * php /var/www/project/bin/console scandio:job-queue:worker --maxJobs="250" # runs every minute # default is always used!
* * * * * php /var/www/project/bin/console scandio:job-queue:worker --maxJobs="250" "load_balance_first"
* * * * * php /var/www/project/bin/console scandio:job-queue:worker --maxJobs="250" "load_balance_second"
* * * * * php /var/www/project/bin/console scandio:job-queue:worker --maxJobs="250" "load_balance_third"
```

### Add Jobs
Expand Down
10 changes: 5 additions & 5 deletions Service/JobManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ public function stats($workerName)
$statistics[$workerName] = array(
'isLocked' => (int) ($isLockedSince instanceof \DateTime),
'isLockedSince' => $isLockedSince instanceof \DateTime ? $isLockedSince->format('d.m.Y H:i:s') : '',
'finished' => $jobRepository->count($workerName, Job::STATE_FINISHED),
'queued' => $jobRepository->count($workerName, Job::STATE_QUEUE),
'active' => $jobRepository->count($workerName, Job::STATE_ACTIVE),
'paused' => $jobRepository->count($workerName, Job::STATE_PAUSED),
'inactive' => $jobRepository->count($workerName, Job::STATE_INACTIVE),
'finished' => $jobRepository->countJobs($workerName, Job::STATE_FINISHED),
'queued' => $jobRepository->countJobs($workerName, Job::STATE_QUEUE),
'active' => $jobRepository->countJobs($workerName, Job::STATE_ACTIVE),
'paused' => $jobRepository->countJobs($workerName, Job::STATE_PAUSED),
'inactive' => $jobRepository->countJobs($workerName, Job::STATE_INACTIVE),
'dead' => (int) $lockRepository->isDead($workerName)
);
}
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

"require": {
"php": ">=5.3.3",
"symfony/framework-bundle": "~2.0"
"symfony/framework-bundle": "~3.0"
},

"autoload": {
Expand Down