Skip to content
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

Revisit the default Scheduled Jobs. Adjust the frequency… #28052

Merged
merged 1 commit into from
Nov 13, 2023

Conversation

agileware-justin
Copy link
Contributor

@agileware-justin agileware-justin commented Nov 8, 2023

…. Remove comments from API parameters which cause the Job to not execute. Update description with parameters comments

Overview

CiviCRM creates default Scheduled Jobs which will not execute when enabled because the parameters include comments and/or have an invalid format. This is a common problem with new CiviCRM sites and even old ones which have been installed and the Scheduled Jobs never really checked thoroughly.

People will typically assume Scheduled Jobs are set up to work and just enable them. It happens alot.

The default frequency of some of the Scheduled Jobs is also too frequent and this PR adjusts that schedule to something more akin to what is usable in the typical shared hosting environment with limited resources.

Have added the following new jobs:

  • Group Cache Flush - as that has been a long time recommendation.
  • Update Individual Postal Greeting - required if this greeting is to be updated (which I had always assumed was done already)
  • Update Individual Addressee - required if this greeting is to be updated
  • Dedupe Contacts - as this is something that would be really useful to have set up from Day 1!

And re-named this job: Update Individual Email Greeting

Before

Some Scheduled Jobs do not work by default.
Parameters include comments.
Frequency of some Scheduled Jobs is too frequent.
Group Cache Flush job does not exist.

After

Scheduled Jobs will work by default if enabled.
Comments are moved to the Job Description.
Frequency of some Scheduled Jobs has been adjusted.
Some new Scheduled Jobs have been added, see above.

Technical Details

Comments

Happy to discuss and listen to any feedback improvements or other ways to ensure that Scheduled Jobs work out of the box.

Agileware Ref: CIVICRM-2189

Copy link

civibot bot commented Nov 8, 2023

🤖 Thank you for contributing to CiviCRM! ❤️ We will need to test and review this PR. 👷

Introduction for new contributors...
  • If this is your first PR, an admin will greenlight automated testing with the command ok to test or add to whitelist.
  • A series of tests will automatically run. You can see the results at the bottom of this page (if there are any problems, it will include a link to see what went wrong).
  • A demo site will be built where anyone can try out a version of CiviCRM that includes your changes.
  • If this process needs to be repeated, an admin will issue the command test this please to rerun tests and build a new demo site.
  • Before this PR can be merged, it needs to be reviewed. Please keep in mind that reviewers are volunteers, and their response time can vary from a few hours to a few weeks depending on their availability and their knowledge of this particular part of CiviCRM.
  • A great way to speed up this process is to "trade reviews" with someone - find an open PR that you feel able to review, and leave a comment like "I'm reviewing this now, could you please review mine?" (include a link to yours). You don't have to wait for a response to get started (and you don't have to stop at one!) the more you review, the faster this process goes for everyone 😄
  • To ensure that you are credited properly in the final release notes, please add yourself to contributor-key.yml
  • For more information about contributing, see CONTRIBUTING.md.
Quick links for reviewers...

➡️ Online demo of this PR 🔗

@civibot civibot bot added the master label Nov 8, 2023
@eileenmcnaughton
Copy link
Contributor

@agileware-justin I think one of the descriptions must be too long - test fails

PR@2/BKPROF/dfl/SUITES/phpunit-api3/label/bknix-tmp/junit api_v3_AllTests

Started: Tue Nov 7 06:27:35 PM PST 2023

######################################################################
RUN:[[./scripts/phpunit --tap --log-junit '/home/homer/workspace/CiviCRM-Core-Matrix-PR@2/BKPROF/dfl/SUITES/phpunit-api3/label/bknix-tmp/junit/api_v3_AllTests.xml' '--exclude-group' 'ornery' 'api_v3_AllTests']]
Installing build4test_nw8hk schema
PHPUnit 9.6.5 by Sebastian Bergmann and contributors.

Error in bootstrap script: PDOException:
SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'description' at row 6
#0 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test.php(243): PDO->query('INSERT INTO civ...')
#1 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test/Data.php(32): Civi\Test::execute('INSERT INTO civ...')
#2 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test.php(40): Civi\Test\Data->Civi\Test{closure}()
#3 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test/Data.php(46): Civi\Test::asPreInstall(Object(Closure))
#4 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test.php(126): Civi\Test\Data->populate()
#5 [internal function]: Civi\Test::Civi{closure}(Object(Civi\Test\CiviEnvBuilder))
#6 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test/CiviEnvBuilder/CallbackStep.php(27): call_user_func(Object(Closure), Object(Civi\Test\CiviEnvBuilder))
#7 /home/homer/buildkit/build/build-4/web/sites/all/modules/civicrm/Civi/Test/CiviEnvBuilder.php(196): Civi\Test\CiviEnvBuilder\CallbackStep->run(Object(Civi\Test\CiviEnvBuilder))

@agileware-justin
Copy link
Contributor Author

Ta @eileenmcnaughton have reworked the descriptions.

Comment on lines 66 to 68
gt=[email_greeting or postal_greeting or addressee] required
force=[0 or 1]
limit=[Number] - Limit contacts to update',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, in the description the newlines don't make much sense.

@eileenmcnaughton
Copy link
Contributor

test fail doesn't look related ( - test this please )

Overall this looks like nice work - so keen to see this merged once the above feedback is worked through

…. Remove comments from API parameters which cause the Job to not execute. Include documentation URL in job description. Add new jobs.
@agileware-justin
Copy link
Contributor Author

PR updated. I think it makes sense to link to the docs so people can RTFM.

Have added the following new jobs:

  • Group Cache Flush - as that has been a long time recommendation.
  • Update Individual Postal Greeting - required if this greeting is to be updated (which I had always assumed was done already)
  • Update Individual Addressee - required if this greeting is to be updated
  • Dedupe Contacts - as this is something that would be really useful to have set up from Day 1!

And re-named this job: Update Individual Email Greeting

@agileware-justin
Copy link
Contributor Author

Test fail doesn't look related ( - test this please )

@seamuslee001
Copy link
Contributor

I think this seems fine to me and noting this only affects new installs directly and I think that is fine flagging as merge ready in case anyone has any more ideas

@seamuslee001 seamuslee001 added the merge ready PR will be merged after a few days if there are no objections label Nov 10, 2023
@demeritcowboy
Copy link
Contributor

Some people use the name in post-install scripts to enable/disable jobs so that might silently fail for the one with the name change, but I don't think it's a blocker.

Will need regen, but can be done after, just means the online demo here doesn't show the changes.

@colemanw colemanw merged commit 2e8aeca into civicrm:master Nov 13, 2023
@demeritcowboy
Copy link
Contributor

I've added a suggested note to the dev-digest about post-install scripts that will need updating.

And regen PR is at #28116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
master merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants