mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
Merge pull request #266 from limingxinleo/dev
Fixed timeout when produce a amqp message.
This commit is contained in:
commit
a520f239fb
@ -1,5 +1,9 @@
|
|||||||
# v1.0.7 - TBD
|
# v1.0.7 - TBD
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- [#266](https://github.com/hyperf-cloud/hyperf/pull/266) Fixed timeout when produce a amqp message.
|
||||||
|
|
||||||
# v1.0.6 - 2019-07-24
|
# v1.0.6 - 2019-07-24
|
||||||
|
|
||||||
## Added
|
## Added
|
||||||
|
@ -139,7 +139,7 @@ class Connection extends BaseConnection implements ConnectionInterface
|
|||||||
$class = AMQPSwooleConnection::class;
|
$class = AMQPSwooleConnection::class;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastHeartbeatTime = 0;
|
$this->lastHeartbeatTime = microtime(true);
|
||||||
return new $class($this->config['host'] ?? 'localhost', $this->config['port'] ?? 5672, $this->config['user'] ?? 'guest', $this->config['password'] ?? 'guest', $this->config['vhost'] ?? '/', $this->params->isInsist(), $this->params->getLoginMethod(), $this->params->getLoginResponse(), $this->params->getLocale(), $this->params->getConnectionTimeout(), $this->params->getReadWriteTimeout(), $this->params->getContext(), $this->params->isKeepalive(), $this->params->getHeartbeat());
|
return new $class($this->config['host'] ?? 'localhost', $this->config['port'] ?? 5672, $this->config['user'] ?? 'guest', $this->config['password'] ?? 'guest', $this->config['vhost'] ?? '/', $this->params->isInsist(), $this->params->getLoginMethod(), $this->params->getLoginResponse(), $this->params->getLocale(), $this->params->getConnectionTimeout(), $this->params->getReadWriteTimeout(), $this->params->getContext(), $this->params->isKeepalive(), $this->params->getHeartbeat());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,13 +149,8 @@ class Connection extends BaseConnection implements ConnectionInterface
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$lastHeartbeatTime = $this->lastHeartbeatTime;
|
if (microtime(true) - $this->lastHeartbeatTime > $this->params->getHeartbeat()) {
|
||||||
$currentTime = microtime(true);
|
return true;
|
||||||
|
|
||||||
if ($lastHeartbeatTime && $lastHeartbeatTime > 0) {
|
|
||||||
if ($currentTime - $lastHeartbeatTime > $this->params->getHeartbeat()) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user