Skip to content

Commit 71b38d8

Browse files
author
Devon Weller
committed
use heartbeat and timeouts
1 parent 5b1734c commit 71b38d8

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

config/rabbitmq.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
* Determine the number of seconds to sleep if there's an error communicating with rabbitmq
8080
* If set to false, it'll throw an exception rather than doing the sleep for X seconds.
8181
*/
82-
'sleep_on_error' => env('RABBITMQ_ERROR_SLEEP', 5),
82+
'sleep_on_error' => false,
8383

8484
/*
8585
* Optional SSL params if an SSL connection is used
@@ -104,4 +104,13 @@
104104
*/
105105
'timeout' => env('RABBITMQ_RECEIVE_TIMEOUT', 5000),
106106
],
107+
108+
/**
109+
* default to an 8 second heartbeat
110+
*/
111+
'timeouts' => [
112+
'read' => 16,
113+
'write' => 16,
114+
'heartbeat' => 8,
115+
]
107116
];

src/Queue/Connectors/RabbitMQConnector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public function connect(array $config): Queue
5858
'ssl_key' => $config['ssl_params']['local_key'],
5959
'ssl_passphrase' => $config['ssl_params']['passphrase'],
6060
'receive_method' => isset($config['receive']) ? $config['receive']['method'] : 'basic_get',
61+
'heartbeat' => isset($config['timeouts']) ? $config['timeouts']['heartbeat'] : 0,
62+
'read_timeout' => isset($config['timeouts']) ? $config['timeouts']['read'] : 3,
63+
'write_timeout' => isset($config['timeouts']) ? $config['timeouts']['write'] : 3,
6164
]);
6265

6366
if ($factory instanceof DelayStrategyAware) {

0 commit comments

Comments
 (0)