Page MenuHomePhabricator

D20529.diff
No OneTemporary

D20529.diff

diff --git a/src/future/asana/PhutilAsanaFuture.php b/src/future/asana/PhutilAsanaFuture.php
--- a/src/future/asana/PhutilAsanaFuture.php
+++ b/src/future/asana/PhutilAsanaFuture.php
@@ -7,6 +7,7 @@
private $action;
private $params;
private $method = 'GET';
+ private $timeout;
public function __construct() {
parent::__construct(null);
@@ -28,6 +29,15 @@
return $this;
}
+ public function setTimeout($timeout) {
+ $this->timeout = $timeout;
+ return $this;
+ }
+
+ public function getTimeout() {
+ return $this->timeout;
+ }
+
protected function getProxiedFuture() {
if (!$this->future) {
$params = $this->params;
@@ -54,6 +64,11 @@
$future->addHeader('Authorization', 'Bearer '.$this->accessToken);
$future->setMethod($this->method);
+ $timeout = $this->getTimeout();
+ if ($timeout !== null) {
+ $future->setTimeout($timeout);
+ }
+
$this->future = $future;
}
diff --git a/src/future/oauth/PhutilOAuth1Future.php b/src/future/oauth/PhutilOAuth1Future.php
--- a/src/future/oauth/PhutilOAuth1Future.php
+++ b/src/future/oauth/PhutilOAuth1Future.php
@@ -23,6 +23,7 @@
private $hasConstructedFuture;
private $callbackURI;
private $headers = array();
+ private $timeout;
public function setCallbackURI($callback_uri) {
$this->callbackURI = $callback_uri;
@@ -74,6 +75,15 @@
return $this;
}
+ public function setTimeout($timeout) {
+ $this->timeout = $timeout;
+ return $this;
+ }
+
+ public function getTimeout() {
+ return $this->timeout;
+ }
+
public function __construct($uri, $data = array()) {
$this->uri = new PhutilURI((string)$uri);
$this->data = $data;
@@ -135,6 +145,11 @@
}
$this->headers = array();
+ $timeout = $this->getTimeout();
+ if ($timeout !== null) {
+ $future->setTimeout($timeout);
+ }
+
$this->hasConstructedFuture = true;
}

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 30, 8:29 PM (5 d, 20 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6714032
Default Alt Text
D20529.diff (1 KB)

Event Timeline