Skip to content

Fix/connection on queue work#337

Open
LucasOtaviani wants to merge 5 commits intoconvenia:masterfrom
LucasOtaviani:fix/connection-on-queue-work
Open

Fix/connection on queue work#337
LucasOtaviani wants to merge 5 commits intoconvenia:masterfrom
LucasOtaviani:fix/connection-on-queue-work

Conversation

@LucasOtaviani
Copy link
Contributor

@LucasOtaviani LucasOtaviani commented Feb 27, 2026

Hello, @jleonardolemos! I’ve opened this pull request to address an issue that occurs when using Pigeon with a queue worker.

The Problem

In PigeonServiceProvider, the manager is registered as a singleton:

$this->app->singleton('pigeon', fn($app) => new PigeonManager($app));

Since the queue worker keeps the singleton instance alive for the entire lifetime of the command, the underlying connection may eventually be lost. 😞

image

Proposed Solution

I reused the missedHeartBeat method to handle AMQPConnectionClosedException, instead of only AMQPHeartbeatMissedException, since the latter extends the same closed connection context.

Another option would be to catch RuntimeException, as it covers both exceptions mentioned above. However, I’d prefer to validate this approach incrementally before broadening the scope too much.

image

P.S.: I don’t think we should handle TimeoutException or IOException at this point.

What are your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant