Skip to content

Commit 570df96

Browse files
authored
Fixed bug that retry_interval does not work for rpc-multiplex. (#3794)
1 parent eca0657 commit 570df96

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/Transporter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Transporter implements TransporterInterface
4141
],
4242
'recv_timeout' => 5.0,
4343
'retry_count' => 2,
44-
'retry_interval' => 100,
44+
'retry_interval' => 0,
4545
'client_count' => 4,
4646
];
4747

@@ -55,6 +55,7 @@ public function __construct(ContainerInterface $container, array $config = [])
5555
public function send(string $data)
5656
{
5757
$retryCount = $this->config['retry_count'] ?? 2;
58+
$retryInterval = $this->config['retry_interval'] ?? 0;
5859
$result = retry($retryCount, function () use ($data) {
5960
try {
6061
return $this->factory->get()->request($data);
@@ -65,7 +66,7 @@ public function send(string $data)
6566

6667
return new ExceptionThrower($exception);
6768
}
68-
});
69+
}, $retryInterval);
6970

7071
if ($result instanceof ExceptionThrower) {
7172
throw $result->getThrowable();

tests/Cases/TransporterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,15 @@ public function testConfig()
3939

4040
$transporter = new Transporter($container, [
4141
'connect_timeout' => $timeout = rand(50, 100),
42+
'retry_interval' => 123,
4243
]);
4344

4445
$invoker = new ClassInvoker($transporter);
4546
$this->assertSame($timeout, $invoker->config['connect_timeout']);
4647

4748
$factory = new ClassInvoker($invoker->factory);
4849
$this->assertSame($timeout, $factory->config['connect_timeout']);
50+
51+
$this->assertSame(123, $factory->config['retry_interval']);
4952
}
5053
}

0 commit comments

Comments
 (0)