Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix (Core) Fixed calculateBackoffTime in JobQueueManagerAPIImpl (#30350)
This pull request introduces enhancements to the job queue management system to handle empty queue scenarios more effectively. The key changes include adding constants to cap and reset the empty queue count, refactoring the backoff time calculation, and adding tests for the new functionality. Enhancements to job queue management: * [`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R117-R121): Introduced `MAX_EMPTY_QUEUE_COUNT` and `EMPTY_QUEUE_RESET_THRESHOLD` constants to cap and reset the empty queue count. * [`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561L476-R485): Refactored `processJobs` method to use `calculateBackoffTime` and `incrementAndResetEmptyQueueCount` methods for better handling of empty queue scenarios. * [`dotCMS/src/main/java/com/dotcms/jobs/business/api/JobQueueManagerAPIImpl.java`](diffhunk://#diff-c092f8af2f800c0ca84f2c2f4aed0af60d0ed488e20fa32992967e154064f561R975-R1005): Added `calculateBackoffTime` and `incrementAndResetEmptyQueueCount` methods to encapsulate the logic for calculating backoff time and resetting the empty queue count. Testing improvements: * [`dotcms-integration/src/test/java/com/dotcms/jobs/business/api/JobQueueManagerAPITest.java`](diffhunk://#diff-93563af6a56c7a961561131bb9cb95c6ea24b9ba8508e3a98dc49d036ff78859R1293-R1312): Added `test_calculateBackoffTime` method to verify the correctness of the `calculateBackoffTime` method under various scenarios.
- Loading branch information