Skip to content

[12.x] LostConnectionDetector and ConcurrencyErrorDetector #56493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 3, 2025

Conversation

vadimonus
Copy link
Contributor

@vadimonus vadimonus commented Jul 31, 2025

Currently there is no way to extend logic of DetectsLostConnections and DetectsConcurrencyErrors traits. The existing list of exception strings does not cover the list of all possible exceptions that may indicate a connection loss.

For example, we had an error Predis\Connection\ConnectionException with the text Connection timed out [tcp://1.2.3.4:6379] when working with predis and it did not resolved new addresses after redis node restart. Of course, traits do not provide exceptions for custom database and queues drivers. Therefore, the ability to extend their behavior may be required, but this is impossible while the logic is in the trait.

In this MR, the logic is transferred from traits to separate contracts and classes, which can then be extended by application users.

Changes are expected to be backward compatible with current version.
As far as this traits are used as a part of databaseManager, that can be used outside of laravel with Capsule, it tries to take detector from container, with fallback to default implementation

@vadimonus vadimonus force-pushed the lost-connection-detector-l12 branch from 1f9a04e to a52c751 Compare July 31, 2025 05:48
@vadimonus vadimonus marked this pull request as draft July 31, 2025 05:50
@vadimonus vadimonus force-pushed the lost-connection-detector-l12 branch from a52c751 to 536c046 Compare July 31, 2025 12:25
@vadimonus vadimonus force-pushed the lost-connection-detector-l12 branch from 536c046 to f7b300f Compare July 31, 2025 12:37
@vadimonus vadimonus marked this pull request as ready for review July 31, 2025 12:42
@taylorotwell taylorotwell merged commit f9e89bb into laravel:12.x Aug 3, 2025
60 checks passed
@vadimonus vadimonus deleted the lost-connection-detector-l12 branch August 7, 2025 20:02
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.

2 participants