summaryrefslogtreecommitdiff
path: root/php-src/tests/stop.php
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-05-31 15:19:54 +0300
committerWolfy-J <[email protected]>2018-05-31 15:19:54 +0300
commit91a081e3ec43302ca1df8d436e48c2a14d7c76b9 (patch)
tree7c644b8bccf04f1a8dd5c07314665152dbea6d63 /php-src/tests/stop.php
parent48f4f7a39a2336be24cc74b4116c02cc941dbd9a (diff)
psr7 support
Diffstat (limited to 'php-src/tests/stop.php')
-rw-r--r--php-src/tests/stop.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/php-src/tests/stop.php b/php-src/tests/stop.php
new file mode 100644
index 00000000..caa485d6
--- /dev/null
+++ b/php-src/tests/stop.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * @var Goridge\RelayInterface $relay
+ */
+
+use Spiral\Goridge;
+use Spiral\RoadRunner;
+
+$rr = new RoadRunner\Worker($relay);
+
+$used = false;
+while ($in = $rr->receive($ctx)) {
+ try {
+ if ($used) {
+ // kill on second attempt
+ $rr->stop();
+ continue;
+ }
+
+ $used = true;
+ $rr->send((string)getmypid());
+ } catch (\Throwable $e) {
+ $rr->error((string)$e);
+ }
+} \ No newline at end of file