1 | <?php |
||
16 | class HttpClientPoolItem extends FlexibleHttpClient |
||
17 | { |
||
18 | /** @var int Number of request this client is actually sending */ |
||
19 | private $sendingRequestCount = 0; |
||
20 | |||
21 | /** @var bool Status of the http client */ |
||
22 | private $disabled = false; |
||
23 | |||
24 | /** @var \DateTime Time when this client has been disabled */ |
||
25 | private $disabledAt; |
||
26 | |||
27 | /** @var int|null Number of seconds after this client is reenable, by default null: never reenable this client */ |
||
28 | private $reenableAfter; |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | * |
||
33 | * @param null|int $reenableAfter Number of seconds after this client is reenable |
||
34 | */ |
||
35 | public function __construct($client, $reenableAfter = null) |
||
41 | |||
42 | /** |
||
43 | * {@inheritdoc} |
||
44 | */ |
||
45 | public function sendRequest(RequestInterface $request) |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function sendAsyncRequest(RequestInterface $request) |
||
87 | |||
88 | /** |
||
89 | * Get current number of request that is send by the underlying http client. |
||
90 | * |
||
91 | * @return int |
||
92 | */ |
||
93 | public function getSendingRequestCount() |
||
97 | |||
98 | /** |
||
99 | * Disable the current client. |
||
100 | */ |
||
101 | protected function disable() |
||
106 | |||
107 | /** |
||
108 | * Whether this client is disabled or not. |
||
109 | * |
||
110 | * Will also reactivate this client if possible |
||
111 | * |
||
112 | * @return bool |
||
113 | */ |
||
114 | public function isDisabled() |
||
127 | } |
||
128 |