Changeset View
Changeset View
Standalone View
Standalone View
src/conduit/ConduitFuture.php
| <?php | <?php | ||||
| final class ConduitFuture extends FutureProxy { | final class ConduitFuture extends FutureProxy { | ||||
| private $client; | private $client; | ||||
| private $engine; | private $engine; | ||||
| private $conduitMethod; | private $conduitMethod; | ||||
| private $profilerCallID; | |||||
| public function setClient(ConduitClient $client, $method) { | public function setClient(ConduitClient $client, $method) { | ||||
| $this->client = $client; | $this->client = $client; | ||||
| $this->conduitMethod = $method; | $this->conduitMethod = $method; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function isReady() { | protected function getServiceProfilerStartParameters() { | ||||
| if ($this->profilerCallID === null) { | return array( | ||||
| $profiler = PhutilServiceProfiler::getInstance(); | |||||
| $this->profilerCallID = $profiler->beginServiceCall( | |||||
| array( | |||||
| 'type' => 'conduit', | 'type' => 'conduit', | ||||
| 'method' => $this->conduitMethod, | 'method' => $this->conduitMethod, | ||||
| 'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(), | 'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(), | ||||
| )); | ); | ||||
| } | } | ||||
| return parent::isReady(); | protected function getServiceProfilerResultParameters() { | ||||
| return array(); | |||||
| } | } | ||||
| protected function didReceiveResult($result) { | protected function didReceiveResult($result) { | ||||
| if ($this->profilerCallID !== null) { | |||||
| $profiler = PhutilServiceProfiler::getInstance(); | |||||
| $profiler->endServiceCall( | |||||
| $this->profilerCallID, | |||||
| array()); | |||||
| } | |||||
| list($status, $body, $headers) = $result; | list($status, $body, $headers) = $result; | ||||
| if ($status->isError()) { | if ($status->isError()) { | ||||
| throw $status; | throw $status; | ||||
| } | } | ||||
| $capabilities = array(); | $capabilities = array(); | ||||
| foreach ($headers as $header) { | foreach ($headers as $header) { | ||||
| list($name, $value) = $header; | list($name, $value) = $header; | ||||
| ▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines | |||||