summaryrefslogtreecommitdiff
path: root/tests/psr-worker-bench.php
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-01-21 13:25:36 +0300
committerValery Piashchynski <[email protected]>2021-01-21 13:25:36 +0300
commit7da6c78449776e1f3c6716250bca0b712a0423a4 (patch)
treef3512de66aca2bba408485a0ea2fc936c0e4fb9b /tests/psr-worker-bench.php
parent0ff05b2732b4fd0783f959c94c54d7e39169f979 (diff)
Uniform all configs
Add debug server Check nil's for all plugin intialization
Diffstat (limited to 'tests/psr-worker-bench.php')
-rw-r--r--tests/psr-worker-bench.php33
1 files changed, 15 insertions, 18 deletions
diff --git a/tests/psr-worker-bench.php b/tests/psr-worker-bench.php
index e6df81ad..3f6408bf 100644
--- a/tests/psr-worker-bench.php
+++ b/tests/psr-worker-bench.php
@@ -1,28 +1,25 @@
<?php
-/**
- * @var Goridge\RelayInterface $relay
- */
-use Spiral\Goridge;
+
use Spiral\RoadRunner;
+use Nyholm\Psr7\Factory;
ini_set('display_errors', 'stderr');
-require __DIR__ . "/vendor/autoload.php";
+include "vendor/autoload.php";
-$worker = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT));
-$psr7 = new RoadRunner\Http\PSR7Worker(
- $worker,
- new \Nyholm\Psr7\Factory\Psr17Factory(),
- new \Nyholm\Psr7\Factory\Psr17Factory(),
- new \Nyholm\Psr7\Factory\Psr17Factory()
+$worker = new RoadRunner\Http\PSR7Worker(
+ RoadRunner\Worker::create(),
+ new Factory\Psr17Factory(),
+ new Factory\Psr17Factory(),
+ new Factory\Psr17Factory()
);
-while ($req = $psr7->waitRequest()) {
+while ($req = $worker->waitRequest()) {
try {
- $resp = new \Nyholm\Psr7\Response();
- $resp->getBody()->write("hello world");
-
- $psr7->respond($resp);
+ $rsp = new \Nyholm\Psr7\Response();
+ $rsp->getBody()->write("hello world");
+ error_log("hello");
+ $worker->respond($rsp);
} catch (\Throwable $e) {
- $psr7->getWorker()->error((string)$e);
+ $worker->getWorker()->error((string)$e);
}
-}
+} \ No newline at end of file