diff --git a/src/sentry/publish/sentry.php b/src/sentry/publish/sentry.php index 0c550917d..d23c25081 100644 --- a/src/sentry/publish/sentry.php +++ b/src/sentry/publish/sentry.php @@ -184,6 +184,7 @@ // Transport configuration 'transport_channel_size' => (int) env('SENTRY_TRANSPORT_CHANNEL_SIZE', 65535), 'transport_concurrent_limit' => (int) env('SENTRY_TRANSPORT_CONCURRENT_LIMIT', 1000), + 'transport_timeout' => (float) env('SENTRY_TRANSPORT_TIMEOUT', -1), 'http_timeout' => (float) env('SENTRY_HTTP_TIMEOUT', 2.0), ]; diff --git a/src/sentry/src/Transport/CoHttpTransport.php b/src/sentry/src/Transport/CoHttpTransport.php index 0c26c4f0a..3e1a39812 100644 --- a/src/sentry/src/Transport/CoHttpTransport.php +++ b/src/sentry/src/Transport/CoHttpTransport.php @@ -42,6 +42,8 @@ class CoHttpTransport implements TransportInterface protected int $channelSize = 65535; + protected float $timeout = -1; + public function __construct( protected ContainerInterface $container, ) { @@ -50,10 +52,16 @@ public function __construct( if ($channelSize > 0) { $this->channelSize = $channelSize; } + $concurrentLimit = (int) $config->get('sentry.transport_concurrent_limit', 1000); if ($concurrentLimit > 0) { $this->concurrent = new Concurrent($concurrentLimit); } + + $timeout = (float) $config->get('sentry.transport_timeout', -1); + if ($timeout > 0) { + $this->timeout = $timeout; + } } public function send(Event $event): Result @@ -61,7 +69,8 @@ public function send(Event $event): Result $this->loop(); $chan = $this->chan; - $chan?->push($event); + // push event to channel, if timeout is set, it will wait for the specified time + $chan?->push($event, $this->timeout); return new Result(ResultStatus::success(), $event); } diff --git a/src/tinker/src/Command/TinkerCommand.php b/src/tinker/src/Command/TinkerCommand.php index 302289d72..4a19c6e80 100644 --- a/src/tinker/src/Command/TinkerCommand.php +++ b/src/tinker/src/Command/TinkerCommand.php @@ -57,7 +57,12 @@ public function handle() $config = Configuration::fromInput($this->input); $config->setUpdateCheck(Checker::NEVER); - $config->setUpdateManualCheck(ManualUpdaterChecker::NEVER); + if ( + method_exists($config, 'setUpdateManualCheck') + && class_exists(ManualUpdaterChecker::class) + ) { + $config->setUpdateManualCheck(ManualUpdaterChecker::NEVER); + } $config->setUsePcntl((bool) $this->config->get('tinker.usePcntl', false)); $config->getPresenter()->addCasters( $this->getCasters()