瀏覽代碼

Change iter to iterations. must be tested

Marc 13 年之前
父節點
當前提交
0bfdb927e9

+ 1 - 1
Command/GearmanJobDescribeCommand.php

@@ -54,7 +54,7 @@ class GearmanJobDescribeCommand extends ContainerAwareCommand
         $job = $worker['job'];
         $output->writeln('<info>    @job\methodName : '.$job['methodName'].'</info>');
         $output->writeln('<info>    @job\callableName : '.$job['realCallableName'].'</info>');
-        $output->writeln('<info>    @job\iterations : '.$job['iter'].'</info>');
+        $output->writeln('<info>    @job\iterations : '.$job['iterations'].'</info>');
         $output->writeln('<info>    @job\servers :</info>');
         $output->writeln('');
         foreach ($job['servers'] as $name => $server) {

+ 2 - 2
Driver/Gearman/GearmanAnnotations.php

@@ -31,7 +31,7 @@ final class Work extends Annotation
      *
      * @var integer
      */
-    public $iter = null;
+    public $iterations = null;
 
     /**
      * Servers assigned for all jobs of this work to be executed
@@ -71,7 +71,7 @@ final class Job extends Annotation
      *
      * @var integer
      */
-    public $iter = null;
+    public $iterations = null;
 
     /**
      * Servers assigned for this job to be executed

+ 8 - 8
Module/JobClass.php

@@ -53,20 +53,20 @@ class JobClass
                                     $methodAnnotation->description :
                                     'No description is defined';
 
-        if (null !== $settings['defaults']['iter']) {
-            $iter = (int) ($settings['defaults']['iter']);
+        if (null !== $settings['defaults']['iterations']) {
+            $iter = (int) ($settings['defaults']['iterations']);
 
-            if (null !== $classAnnotation->iter) {
-                $iter = (int) ($classAnnotation->iter);
+            if (null !== $classAnnotation->iterations) {
+                $iter = (int) ($classAnnotation->iterations);
             }
 
-            if (null !== $methodAnnotation->iter) {
-                $iter = (int) ($methodAnnotation->iter);
+            if (null !== $methodAnnotation->iterations) {
+                $iter = (int) ($methodAnnotation->iterations);
             }
         } else {
             throw new SettingValueMissingException('defaults/iter');
         }
-        $this->iter = $iter;
+        $this->iterations = $iter;
 
         /**
          * Servers definition for job
@@ -117,7 +117,7 @@ class JobClass
             'methodName'            =>  $this->methodName,
             'realCallableName'      =>  $this->realCallableName,
             'description'           =>  $this->description,
-            'iter'                  =>  $this->iter,
+            'iterations'			=>  $this->iterations,
             'servers'               =>  $this->servers,
         );
     }

+ 4 - 4
Service/GearmanExecute.php

@@ -56,8 +56,8 @@ class GearmanExecute extends GearmanService
 
         $gmworker->addFunction($job['realCallableName'], array($objInstance, $job['methodName']));
 
-        $iter = isset($job['iter']) ? (int) ($job['iter']) : 0;
-        $shouldStop = ($iter > 0) ? true : false;
+        $iterations = isset($job['iterations']) ? (int) ($job['iterations']) : 0;
+        $shouldStop = ($iterations > 0) ? true : false;
 
         while ($gmworker->work()) {
 
@@ -66,8 +66,8 @@ class GearmanExecute extends GearmanService
             }
 
             if ($shouldStop) {
-                $iter--;
-                if ($iter <= 0) {
+                $iterations--;
+                if ($iterations <= 0) {
                     break;
                 }
             }

+ 1 - 1
Workers/testWorker.php

@@ -11,7 +11,7 @@ class testWorker
      * 
      * @param \GearmanJob $job Object with job parameters
      *
-     * @Gearman\Job(iter=3, name="test", description="This is a description")     *
+     * @Gearman\Job(iterations=3, name="test", description="This is a description")     *
      */
     public function testA(\GearmanJob $job)
     {

+ 1 - 1
config.example.yml

@@ -27,4 +27,4 @@ defaults:
   
   # Default number of executions before job dies.
   # If annotations defined, will be overwritten
-  iter: 150
+  iterations: 150