update patch 1
This commit is contained in:
+6
-8
@@ -28,22 +28,20 @@ class RoundRobinTransport implements TransportInterface
|
||||
* @var \SplObjectStorage<TransportInterface, float>
|
||||
*/
|
||||
private \SplObjectStorage $deadTransports;
|
||||
private array $transports = [];
|
||||
private int $retryPeriod;
|
||||
private int $cursor = -1;
|
||||
|
||||
/**
|
||||
* @param TransportInterface[] $transports
|
||||
*/
|
||||
public function __construct(array $transports, int $retryPeriod = 60)
|
||||
{
|
||||
public function __construct(
|
||||
private array $transports,
|
||||
private int $retryPeriod = 60,
|
||||
) {
|
||||
if (!$transports) {
|
||||
throw new TransportException(sprintf('"%s" must have at least one transport configured.', static::class));
|
||||
throw new TransportException(\sprintf('"%s" must have at least one transport configured.', static::class));
|
||||
}
|
||||
|
||||
$this->transports = $transports;
|
||||
$this->deadTransports = new \SplObjectStorage();
|
||||
$this->retryPeriod = $retryPeriod;
|
||||
}
|
||||
|
||||
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
|
||||
@@ -55,7 +53,7 @@ class RoundRobinTransport implements TransportInterface
|
||||
return $transport->send($message, $envelope);
|
||||
} catch (TransportExceptionInterface $e) {
|
||||
$exception ??= new TransportException('All transports failed.');
|
||||
$exception->appendDebug(sprintf("Transport \"%s\": %s\n", $transport, $e->getDebug()));
|
||||
$exception->appendDebug(\sprintf("Transport \"%s\": %s\n", $transport, $e->getDebug()));
|
||||
$this->deadTransports[$transport] = microtime(true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user