-
Notifications
You must be signed in to change notification settings - Fork 8
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
MAE-318: Use queue to process memberships #348
base: master
Are you sure you want to change the base?
Conversation
@ana-compucorp Nice approach! |
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.
- Can you explain help more on the first commit on the technical details why we need to set the current path in order to resolve the 'undefined index' error?
- Can you confirm if schedule job is working properly with cron job as we do not normally run schedule job via the UI. Can you perhaps explain and show some screenshots in the after section?
- I am not 100% sure which commands that infrastructure team use for running cron either
cvapi -u 1 job.execute
or URL over http(s). I think it is the best to check with them and update the README they are a couple of cautions regarding schedule job as if we use https(s) it will time out anyway if the queue is large or if we would need to have this schedule job separate from normal CiviCRM corn cc @omarabuhussein
ec3255c
to
77d14ee
Compare
I double-checked the commit |
5c26873
to
5e73186
Compare
Updated the commit message and the PR description to make it more clear.
Yes, and no change needed if you run the job form the cron job.
Using the |
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.
@ahed-compucorp look good to me. I'll leave the final review to @omarabuhussein as we might need second eyes on this.
tests/phpunit/CRM/MembershipExtras/Hook/PostProcess/UpdateSubscriptionTest.php
Show resolved
Hide resolved
CRM/MembershipExtras/Job/OfflineAutoRenewal/MultipleInstalmentPlan.php
Outdated
Show resolved
Hide resolved
tests/phpunit/CRM/MembershipExtras/Queue/Builder/OfflineMultipleInstalmentPlansTest.php
Outdated
Show resolved
Hide resolved
These test will implicitly call the method `CRM_Utils_System::currentPath` which will raise 'Undefined index:q' notice because PHPUnit converts PHP errors, warnings, and notices that are triggered during the execution of a test to an exception.
A simple array of integers to hold the IDs is enough because the number of installments is not used.
5e73186
to
1c3d595
Compare
Use CiviCRM queue to process the memberships asynchronically to the auto-renewal job execution if the job triggered from the browser
1c3d595
to
8392754
Compare
0a946b9
to
4ed4543
Compare
If the job executed during the execution of the queue, there will be repeated tasks in the queue and this commit fixed it and only adds tasks when the queue is empty.
The created folders will hold the related classes and give a better separation.
4ed4543
to
c10abcc
Compare
Will wait for #355 to be merged then will rebase this PR. |
Overview
The
OfflineAutoRenewalJob
job is responsible for membership auto-renewal butthere is a timeout issue when many records exist and the admin run the job for the first time on the test site.
Before
After
Technical Details
The feature will help the admin see the job's progress only when he executes it from CiviCRM UI. No change needed to the way we run the job (
cv api
,drush
,HTTP request
).CiviCRM queue has Claim item concept that handles the case when the admin execute the job, and
cronjob
ran the job during the processing.These are the keys points of this PR:
CRM_Utils_System::currentPath
will raise 'Undefined index: q' notice because PHPUnit converts PHP errors, warnings, and noticesthat are triggered during the execution of a test to an exception. I fixed that.
@throw
line and fix typos in phpdoc.getRecurringContributions
to return an array of integers instead of an array of arrays because the number of installments is not used.OfflineAutoRenewal
to use CiviCRM queue implicitly. I copied everything related as is to preserve the old functionality.