Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F13963694
D18704.id44897.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D18704.id44897.diff
View Options
diff --git a/src/conduit/ConduitClient.php b/src/conduit/ConduitClient.php
--- a/src/conduit/ConduitClient.php
+++ b/src/conduit/ConduitClient.php
@@ -155,12 +155,8 @@
$this->password);
}
- $conduit_future = new ConduitFuture($core_future);
- $conduit_future->setClient($this, $method);
- $conduit_future->beginProfile($data);
- $conduit_future->isReady();
-
- return $conduit_future;
+ return id(new ConduitFuture($core_future))
+ ->setClient($this, $method);
}
public function setBasicAuthCredentials($username, $password) {
diff --git a/src/conduit/ConduitFuture.php b/src/conduit/ConduitFuture.php
--- a/src/conduit/ConduitFuture.php
+++ b/src/conduit/ConduitFuture.php
@@ -2,8 +2,8 @@
final class ConduitFuture extends FutureProxy {
- protected $client;
- protected $conduitMethod;
+ private $client;
+ private $conduitMethod;
private $profilerCallID;
public function setClient(ConduitClient $client, $method) {
@@ -12,15 +12,19 @@
return $this;
}
- public function beginProfile($data) {
- $profiler = PhutilServiceProfiler::getInstance();
- $this->profilerCallID = $profiler->beginServiceCall(
- array(
- 'type' => 'conduit',
- 'method' => $this->conduitMethod,
- 'size' => strlen(http_build_query($data, '', '&')),
- ));
- return $this;
+ public function isReady() {
+ if ($this->profilerCallID === null) {
+ $profiler = PhutilServiceProfiler::getInstance();
+
+ $this->profilerCallID = $profiler->beginServiceCall(
+ array(
+ 'type' => 'conduit',
+ 'method' => $this->conduitMethod,
+ 'size' => $this->getProxiedFuture()->getHTTPRequestByteLength(),
+ ));
+ }
+
+ return parent::isReady();
}
protected function didReceiveResult($result) {
diff --git a/src/future/http/BaseHTTPFuture.php b/src/future/http/BaseHTTPFuture.php
--- a/src/future/http/BaseHTTPFuture.php
+++ b/src/future/http/BaseHTTPFuture.php
@@ -264,6 +264,18 @@
return $this->addHeader('Authorization', 'Basic '.$credentials);
}
+ public function getHTTPRequestByteLength() {
+ // NOTE: This isn't very accurate, but it's only used by the "--trace"
+ // call profiler to help pick out huge requests.
+ $data = $this->getData();
+
+ if (is_scalar($data)) {
+ return strlen($data);
+ }
+
+ return strlen(http_build_query($data, '', '&'));
+ }
+
/* -( Resolving the Request )---------------------------------------------- */
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 16, 5:20 PM (3 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714216
Default Alt Text
D18704.id44897.diff (2 KB)
Attached To
Mode
D18704: Fix a bug which prevented Conduit futures from having parallelism limited effectively
Attached
Detach File
Event Timeline
Log In to Comment