Skip to content

Commit adff6d2

Browse files
committed
added ability on the fly change timeout and reconnect tries for connectors
1 parent 4168df4 commit adff6d2

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

Connectors/ConnectorInterface.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ interface ConnectorInterface
1111
const ANSWER_FORMAT_ARRAY = 'array';
1212
const ANSWER_FORMAT_OBJECT = 'object';
1313

14+
/**
15+
* @param int $timeoutSeconds
16+
*/
17+
public function setConnectionTimeoutSeconds($timeoutSeconds);
18+
19+
/**
20+
* Number of tries to reconnect (get correct answer) to api
21+
*
22+
* @param int $triesN
23+
*/
24+
public function setMaxNumberOfTriesToReconnect($triesN);
25+
1426
/**
1527
* @return string
1628
*/

Connectors/Http/HttpJsonRpcConnectorAbstract.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ public function __construct($orderNodesByTimeoutMs = 0) {
6767
}
6868
}
6969

70+
/**
71+
* @param int $timeoutSeconds
72+
*/
73+
public function setConnectionTimeoutSeconds($timeoutSeconds)
74+
{
75+
$this->wsTimeoutSeconds = $timeoutSeconds;
76+
}
77+
78+
/**
79+
* Number of tries to reconnect (get correct answer) to api
80+
*
81+
* @param int $triesN
82+
*/
83+
public function setMaxNumberOfTriesToReconnect($triesN)
84+
{
85+
$this->maxNumberOfTriesToCallApi = $triesN;
86+
}
87+
7088

7189
/**
7290
* @param integer $orderNodesByTimeoutMs Only if you set few nodes. do not set it is too low, if node do not answer it go out from list

Connectors/WebSocket/WSConnectorAbstract.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,24 @@ public function __construct($orderNodesByTimeout = 0) {
7171
}
7272
}
7373

74+
/**
75+
* @param int $timeoutSeconds
76+
*/
77+
public function setConnectionTimeoutSeconds($timeoutSeconds)
78+
{
79+
$this->wsTimeoutSeconds = $timeoutSeconds;
80+
}
81+
82+
/**
83+
* Number of tries to reconnect (get correct answer) to api
84+
*
85+
* @param int $triesN
86+
*/
87+
public function setMaxNumberOfTriesToReconnect($triesN)
88+
{
89+
$this->maxNumberOfTriesToCallApi = $triesN;
90+
}
91+
7492

7593
/**
7694
* @param integer $orderNodesByTimeout Only if you set few nodes. do not set it is too low, if node do not answer it go out from list

0 commit comments

Comments
 (0)