Skip to content

Commit

Permalink
Merge pull request #2 from answear/update-connection-last-activity-time
Browse files Browse the repository at this point in the history
Update Connection::lastActivityTime by reflection
  • Loading branch information
mglowala authored Jun 7, 2023
2 parents 16c0d5a + f7e5ade commit 1ca6cda
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Transport/AmqpTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ public function getHeartbeat(): int
public function sendHeartbeat(): void
{
try {
if (\property_exists($this->connection, 'lastActivityTime')) {
$reflection = new \ReflectionClass($this->connection);
$property = $reflection->getProperty('lastActivityTime');
$property->setAccessible(true);
$property->setValue($this->connection, time());
}

$this->getMessageCount();
} catch (\Throwable $throwable) {
if ($throwable instanceof TransportException || $throwable->getPrevious() instanceof TransportException) {
Expand Down

0 comments on commit 1ca6cda

Please sign in to comment.