summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Worker.php11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Worker.php b/src/Worker.php
index 2da16e86..d509562e 100644
--- a/src/Worker.php
+++ b/src/Worker.php
@@ -11,8 +11,7 @@ namespace Spiral\RoadRunner;
use Spiral\Goridge\Exceptions\GoridgeException;
use Spiral\Goridge\RelayInterface as Relay;
-use Spiral\Goridge\SocketRelay;
-use Spiral\Goridge\StreamRelay;
+use Spiral\Goridge\SendPackageRelayInterface;
use Spiral\RoadRunner\Exception\RoadRunnerException;
/**
@@ -30,19 +29,15 @@ class Worker
// Send as response context to request worker termination
public const STOP = '{"stop":true}';
- /** @var Relay|StreamRelay|SocketRelay */
+ /** @var Relay */
private $relay;
- /** @var bool */
- private $optimizedRelay;
-
/**
* @param Relay $relay
*/
public function __construct(Relay $relay)
{
$this->relay = $relay;
- $this->optimizedRelay = method_exists($relay, 'sendPackage');
}
/**
@@ -89,7 +84,7 @@ class Worker
*/
public function send(string $payload = null, string $header = null): void
{
- if (!$this->optimizedRelay) {
+ if (!$this->relay instanceof SendPackageRelayInterface) {
if ($header === null) {
$this->relay->send('', Relay::PAYLOAD_CONTROL | Relay::PAYLOAD_NONE);
} else {