-
Notifications
You must be signed in to change notification settings - Fork 238
[cuebot] Add scheduled subscription recalculation task #2134
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
[cuebot] Add scheduled subscription recalculation task #2134
Conversation
9d12277 to
e090665
Compare
CI Failure AnalysisThe failing checks (Build Cuebot and Run Unit Tests and Run Integration Test) are due to transient infrastructure issues with the Spring repository, not related to the code changes in this PR. Error DetailsThe build is failing with HTTP 401 errors when trying to access VerificationThe latest master branch run (#20526703128) passed successfully, confirming this is a transient issue. RequestCould a maintainer please re-run the failed jobs when the Spring repository is accessible again? Thank you! |
|
Looks like it fails the spotless java checks. |
|
Just a heads up, this PR is still failing CICD with the following error. I'm moving it to Draft state. Please only remove the draft state when it is ready for review. |
3c533ee to
451337f
Compare
|
@DiegoTavares fixed the missing parameter, now CI looks good. Thanks |
451337f to
6f95890
Compare
Add a scheduled task to periodically call the recalculate_subs() database function, eliminating the need for an external cronjob on the database server. Changes: - Add MaintenanceTask enum for subscription recalculation - Add DAO method to call recalculate_subs() function - Add recalculateSubscriptions() to MaintenanceManagerSupport - Add configuration property for subscription recalculation interval - Configure Quartz scheduler for subscription recalculation - Add database migration for subscription recalculation task lock - Bump version to 1.17 for database migration - Add missing test property for subscription recalculation The task uses a database lock to ensure only one Cuebot instance runs the recalculation at a time in multi-instance deployments. Configuration: maintenance.subscription_recalculation_interval_ms (default: 7200000 = 2 hours) Issue Number: close AcademySoftwareFoundation#1562 Signed-off-by: pmady <pavan4devops@gmail.com>
15dc216 to
c35b528
Compare
|
@htehara and @ramonfigueiredo FYI |
|
@htehara can you review the migrations to confirm a task_lock is the best mechanism to prevent multiple executions? |
453d6f4
into
AcademySoftwareFoundation:master
Summary
This PR adds a scheduled task to periodically call the
recalculate_subs()database function, eliminating the need for an external cronjob on the database server.Problem
Subscription accountability has a condition where, when running at large scale, values can become out of date. The
recalculate_subs()function was added in PR #1380 to fix this, but it needs to be called on a schedule. Currently, this requires an external cronjob on the database server, which is not ideal.Solution
This PR integrates the subscription recalculation into cuebot's existing Quartz scheduler infrastructure:
LOCK_SUBSCRIPTION_RECALCULATIONfor database-level locking to prevent concurrent execution across multiple cuebot instancesrecalculateSubscriptions()method to call the PostgreSQL functionrecalculateSubscriptions()method with proper lockingmaintenance.subscription_recalculation_interval_ms(default: 2 hours)Configuration
The interval can be configured via the
maintenance.subscription_recalculation_interval_msproperty inopencue.properties. Default is 7200000 ms (2 hours), matching SPI's production setup.Multi-instance Support
The implementation uses the existing
task_lockmechanism to ensure only one cuebot instance runs the recalculation at a time, even in multi-instance deployments.Closes #1562