diff --git a/src/Worker/CentrifugoWorker.php b/src/Worker/CentrifugoWorker.php index 72ee0b3..414cecc 100755 --- a/src/Worker/CentrifugoWorker.php +++ b/src/Worker/CentrifugoWorker.php @@ -14,6 +14,7 @@ use FluffyDiscord\RoadRunnerBundle\Event\Worker\WorkerBootingEvent; use FluffyDiscord\RoadRunnerBundle\Exception\NoCentrifugoResponseProvidedException; use FluffyDiscord\RoadRunnerBundle\Exception\UnsupportedCentrifugoRequestTypeException; +use GuzzleHttp\Promise\PromiseInterface; use RoadRunner\Centrifugal\API\DTO\V1\DisconnectResponse; use RoadRunner\Centrifugo\CentrifugoWorker as RoadRunnerCentrifugoWorker; use RoadRunner\Centrifugo\Payload\ConnectResponse; @@ -89,7 +90,12 @@ public function start(): void $this->sentryHubInterface?->captureException($throwable); $request->error(500, (string)$throwable); } finally { - $this->sentryHubInterface?->getClient()?->flush()->wait(false); + $result = $this->sentryHubInterface?->getClient()?->flush(); + + // sentry v4 compatibility + if($result instanceof PromiseInterface) { + $result->wait(false); + } $this->sentryHubInterface?->popScope(); } } diff --git a/src/Worker/HttpWorker.php b/src/Worker/HttpWorker.php index 7d227ef..1dae113 100644 --- a/src/Worker/HttpWorker.php +++ b/src/Worker/HttpWorker.php @@ -7,6 +7,7 @@ use FluffyDiscord\RoadRunnerBundle\Factory\DefaultResponseWrapper; use FluffyDiscord\RoadRunnerBundle\Factory\StreamedJsonResponseWrapper; use FluffyDiscord\RoadRunnerBundle\Factory\StreamedResponseWrapper; +use GuzzleHttp\Promise\PromiseInterface; use Nyholm\Psr7; use Sentry\State\HubInterface as SentryHubInterface; use Spiral\RoadRunner; @@ -93,7 +94,13 @@ public function start(): void $worker->getWorker()->error((string)$throwable); } finally { - $this->sentryHubInterface?->getClient()?->flush()->wait(false); + $result = $this->sentryHubInterface?->getClient()?->flush(); + + // sentry v4 compatibility + if($result instanceof PromiseInterface) { + $result->wait(false); + } + $this->sentryHubInterface?->popScope(); } }