[PECL-CVS] [pecl-networking-gearman] fix-worker-exit-job-retry: address reviews

[email protected] (Rasmus Lerdorf) Sat, 4 Apr 2026 14:12:38 +0000
Newsgroups php.pecl.cvs
Message-ID <[email protected]>
Author: Rasmus Lerdorf (rlerdorf)
Date: 2026-04-04T10:12:34-04:00

Commit: https://github.com/php/pecl-networking-gearman/commit/f97773852528e18b7ce5b8d832bdfedd3cebb67c
Raw diff: https://github.com/php/pecl-networking-gearman/commit/f97773852528e18b7ce5b8d832bdfedd3cebb67c.diff

address reviews

Changed paths:
  M  tests/gearman_worker_integration_test_002.phpt


Diff:

diff --git a/tests/gearman_worker_integration_test_002.phpt b/tests/gearman_worker_integration_test_002.phpt
index 9b0749f..a76c5cb 100644
--- a/tests/gearman_worker_integration_test_002.phpt
+++ b/tests/gearman_worker_integration_test_002.phpt
@@ -28,10 +28,9 @@ if ($pid1 === -1) {
 }
 if ($pid1 === 0) {
     $w = new GearmanWorker();
-    $w->addServer($host, $port);
-    $w->addFunction($func, function($job) {
-        exit(1);
-    });
+    if ($w->addServer($host, $port) !== true) exit(2);
+    $w->setTimeout(10000);
+    if ($w->addFunction($func, function($job) { exit(1); }) !== true) exit(2);
     $w->work();
     exit(0);
 }
@@ -50,12 +49,12 @@ if ($pid2 === -1) {
 }
 if ($pid2 === 0) {
     $w = new GearmanWorker();
-    $w->addServer($host, $port);
+    if ($w->addServer($host, $port) !== true) exit(3);
     $w->setTimeout(10000);
-    $w->addFunction($func, function($job) {
+    if ($w->addFunction($func, function($job) {
         echo "payload: " . $job->workload() . PHP_EOL;
         return "done";
-    });
+    }) !== true) exit(3);
     $ret = $w->work();
     exit($ret ? 0 : 2);
 }