Test/queue runner refacto
Description
Fixes #7894 Explain how this code impacts users.
Type of change
- [x] Enhancement (non-breaking change which improves an existing functionality).
- [x] Breaking change (fix or feature that would cause existing functionality to not work as before).
Detailed scenario
What was tested
RUCSS output, Rocket Insights output, Both queue used.
How to test
Describe how the PR can be tested so that the validator can be autonomous: environment, dependencies, specific setup, steps to perform, API requests, etc.
Technical description
Documentation
This pull request introduces a new queue runner for the Rocket Insights workflow and refactors the queue management system to better support multiple queue groups and scheduling intervals. The changes improve the flexibility and maintainability of the job processing infrastructure, allowing for independent queue runners for different optimization types (e.g., RUCSS and Rocket Insights) and more granular scheduling control.
Queue Runner Infrastructure
- Added a new abstract base class
AbstractQueueRunnerininc/Engine/Common/Queue/AbstractQueueRunner.phpto encapsulate common queue runner logic, including cron scheduling, async request dispatch, and batch processing with group support. - Created
QueueRunnerininc/Engine/Admin/RocketInsights/Queue/QueueRunner.phpfor Rocket Insights, implementing a 30-second cron schedule and group-specific processing. - Refactored
RUCSSQueueRunnerto extend the newAbstractQueueRunner, aligning RUCSS queue processing with the new infrastructure.
Dependency Injection & Service Registration
- Registered the new
QueueRunnerfor Rocket Insights in the service provider, including singleton management and container wiring for dependency injection. [1] [2] [3]
Queue Group Routing & Job Processing
- Updated
Queueininc/Engine/Common/JobManager/Queue/Queue.phpto support dynamic group assignment and provide static factory methods for different optimization types, enabling correct queue routing based on job type. [1] [2] - Refactored
JobProcessorininc/Engine/Common/JobManager/JobProcessor.phpto remove direct queue injection and instead select the appropriate queue instance per job, ensuring jobs are processed by the correct queue runner. [1] [2] [3] [4]
Rocket Insights Subscriber Integration
- Integrated the Rocket Insights queue runner into the subscriber lifecycle, including initialization, cleanup on deactivation, and event registration for cron management. [1] [2] [3] [4] [5]
Mandatory Checklist
Code validation
- [ ] I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
- [ ] I triggered all changed lines of code at least once without new errors/warnings/notices.
- [ ] I implemented built-in tests to cover the new/changed code.
Code style
- [ ] I wrote a self-explanatory code about what it does.
- [ ] I protected entry points against unexpected inputs.
- [ ] I did not introduce unnecessary complexity.
- [ ] Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.
Unticked items justification
If some mandatory items are not relevant, explain why in this section.
Additional Checks
- [ ] In the case of complex code, I wrote comments to explain it.
- [ ] When possible, I prepared ways to observe the implemented system (logs, data, etc.).
- [ ] I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)
Coverage summary from Codacy
See diff coverage on Codacy
| Coverage variation | Diff coverage |
|---|---|
| Report missing for be7fb39be6bce19cb01691cef5ea705793faa43f[^1] | :x: 29.52% (target: 50.00%) |
Coverage variation details
| Coverable lines | Covered lines | Coverage | |
|---|---|---|---|
| Common ancestor commit (be7fb39be6bce19cb01691cef5ea705793faa43f) | Report Missing | Report Missing | Report Missing |
| Head commit (64ea97d0cf788b6564e53c876f190c53fbe3a1b0) | 41803 | 18772 | 44.91% |
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>
Diff coverage details
| Coverable lines | Covered lines | Diff coverage | |
|---|---|---|---|
| Pull request (#7905) | 105 | 31 | 29.52% |
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%
See your quality gate settings Change summary preferences
[^1]: Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.