From 298db0ab507b989a72c1b092bdf407197f373712 Mon Sep 17 00:00:00 2001 From: nightlinus Date: Tue, 9 Apr 2019 12:37:22 +0300 Subject: [PATCH] Fix heartbeat configuration in bunny with 0 (off) value When bunny doesn't see heartbeat key in bunnyConfig it set default value to 60 seconds. So when one set hearbeat to zero, code ignore setting this key to bunnyConfig --- pkg/amqp-bunny/AmqpConnectionFactory.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/amqp-bunny/AmqpConnectionFactory.php b/pkg/amqp-bunny/AmqpConnectionFactory.php index 241929abe..ca56d428c 100644 --- a/pkg/amqp-bunny/AmqpConnectionFactory.php +++ b/pkg/amqp-bunny/AmqpConnectionFactory.php @@ -87,6 +87,7 @@ private function establishConnection(): BunnyClient $bunnyConfig['password'] = $this->config->getPass(); $bunnyConfig['read_write_timeout'] = min($this->config->getReadTimeout(), $this->config->getWriteTimeout()); $bunnyConfig['timeout'] = $this->config->getConnectionTimeout(); + $bunnyConfig['heartbeat'] = $this->config->getHeartbeat(); // @see https://github.com/php-enqueue/enqueue-dev/issues/229 // $bunnyConfig['persistent'] = $this->config->isPersisted(); @@ -94,10 +95,6 @@ private function establishConnection(): BunnyClient // $bunnyConfig['path'] = 'enqueue';//$this->config->getOption('path', $this->config->getOption('vhost')); // } - if ($this->config->getHeartbeat()) { - $bunnyConfig['heartbeat'] = $this->config->getHeartbeat(); - } - if (null !== $this->config->getOption('tcp_nodelay')) { $bunnyConfig['tcp_nodelay'] = $this->config->getOption('tcp_nodelay'); }