Skip to content

Commit

Permalink
优化 FutureResponse 结构
Browse files Browse the repository at this point in the history
  • Loading branch information
youmingdot committed Feb 9, 2018
1 parent a9af1bc commit cabb076
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/Routing/FutureResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,17 @@ class FutureResponse extends Response
protected $timeout;

/**
* 设置请求管理器
* 创建延迟响应
*
* @param \Lawoole\Routing\RequestManager $requestManager
* @param int $timeout
*/
public function setRequestManager(RequestManager $requestManager)
public function __construct(RequestManager $requestManager, $timeout = 0)
{
parent::__construct('', 202);

$this->requestManager = $requestManager;
$this->timeout = $timeout;
}

/**
Expand All @@ -43,10 +47,14 @@ public function getRequestManager()
* 设置处理超时
*
* @param float $timeout
*
* @return \Lawoole\Routing\FutureResponse
*/
public function setTimeout($timeout)
{
$this->timeout = $timeout;

return $this;
}

/**
Expand Down

0 comments on commit cabb076

Please sign in to comment.