-
-
Notifications
You must be signed in to change notification settings - Fork 12
feat: migrate failover queue from Laravel #259
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the failover queue functionality to Laravel by introducing a new FailoverQueue implementation that automatically switches between configured queue connections when failures occur. The implementation includes enhanced queue monitoring capabilities through new methods that provide detailed statistics about pending, delayed, and reserved jobs.
Key Changes:
- Added failover queue functionality with automatic connection switching on failures
- Introduced granular queue size methods (pending, delayed, reserved) across all queue implementations
- Enhanced queue monitoring with detailed job statistics
Reviewed Changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/queue/src/FailoverQueue.php | New failover queue implementation with exception handling and event dispatching |
| src/queue/src/Connectors/FailoverConnector.php | Connector for instantiating failover queues |
| src/queue/src/Events/QueueFailedOver.php | Event fired when a queue connection fails over |
| src/queue/src/Contracts/Queue.php | Added new interface methods for granular queue size metrics |
| src/queue/src/Queue.php | Added config storage and accessor methods |
| src/queue/src/QueueManager.php | Registered failover connector and updated queue resolution to set config |
| src/queue/src/SqsQueue.php | Implemented new size methods using SQS attributes |
| src/queue/src/RedisQueue.php | Implemented new size methods using Redis data structures |
| src/queue/src/DatabaseQueue.php | Implemented new size methods with database queries |
| src/queue/src/BeanstalkdQueue.php | Implemented new size methods using Beanstalkd stats |
| src/queue/src/SyncQueue.php | Added stub implementations returning 0 for all new size methods |
| src/queue/src/NullQueue.php | Added stub implementations returning 0 for all new size methods |
| src/queue/src/QueuePoolProxy.php | Added proxy methods for new size methods |
| src/queue/src/Console/MonitorCommand.php | Enhanced monitoring command to display new queue statistics |
| src/support/src/Testing/Fakes/QueueFake.php | Added stub implementations for testing |
| src/queue/composer.json | Updated pheanstalk version constraint |
| tests/Queue/FailoverQueueTest.php | Added test for failover behavior |
| tests/Queue/QueueWorkerTest.php | Added stub methods to test queue mock |
| tests/Queue/QueueSqsQueueTest.php | Updated test to verify all SQS attributes are retrieved |
| tests/Queue/QueueManagerTest.php | Updated tests to expect setConfig calls |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| */ | ||
| public function creationTimeOfOldestPendingJob(?string $queue = null): ?int | ||
| { | ||
| return 0; |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The creationTimeOfOldestPendingJob method should return null instead of 0 to match the return type signature ?int and indicate no pending job, consistent with other implementations like SqsQueue and RedisQueue.
| return 0; | |
| return null; |
| */ | ||
| public function creationTimeOfOldestPendingJob(?string $queue = null): ?int | ||
| { | ||
| return 0; |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The creationTimeOfOldestPendingJob method should return null instead of 0 to match the return type signature ?int and indicate no pending job, consistent with the semantic meaning and other implementations.
| return 0; | |
| return null; |
| */ | ||
| public function creationTimeOfOldestPendingJob(?string $queue = null): ?int | ||
| { | ||
| return 0; |
Copilot
AI
Oct 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The creationTimeOfOldestPendingJob method should return null instead of 0 to match the return type signature ?int and indicate no pending job, consistent with other implementations.
| return 0; | |
| return null; |
This PR ports the feature from: laravel/framework#57341