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; }