feat: improved timeout handling for api client

This commit is contained in:
Björn Fromme
2026-03-16 11:59:11 +01:00
parent be90248fc7
commit 37924841e1
14 changed files with 139 additions and 14 deletions
+9 -3
View File
@@ -436,10 +436,13 @@ class ApiClient
$socket = $this->connect(
$this->config['bpn_api_ip'],
$this->config['bpn_api_port'],
$this->config['max_retries']
$this->config['max_retries'],
$this->config['connection_timeout'],
$this->config['stream_timeout'],
$this->config['total_timeout']
);
$this->send($socket, $body);
$response = $this->receive($socket);
$this->send($socket, $body, $this->config['total_timeout']);
$response = $this->receive($socket, $this->config['total_timeout']);
$this->disconnect($socket);
// message length (10 bytes) is prepended to actual message
@@ -489,6 +492,9 @@ class ApiClient
$optionsResolver->setDefaults([
'max_retries' => 25,
'debug' => false,
'connection_timeout' => 5,
'stream_timeout' => 30,
'total_timeout' => 45,
]);
return $optionsResolver->resolve($options);