Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.7.25
-
Fix Version/s: 4.7.30
-
Component/s: CiviMail
-
Labels:
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:User and Admin Doc
-
Funding Source:Contributed Code
-
Verified?:No
Description
In CiviMail compose screen, there are few issues on how the recipient count and list are fetched automatically, these are:
- Every time mailing groups are included or excluded from recipient field, this causes a repetitive call to mailingRecipient.get API to fetch count and list of recipients.
- Four mailing fields are constantly monitored at a timespan of 100ms and in the process, it call previewRecipientCount angular service which eventually triggers mailingRecipient.getcount API to calculate recipient count.
In order to avoid such repetitive API call, some improvements are made which are:
- Added a new CiviMail component settings 'auto_recipient_rebuild', set default to TRUE.
- This setting allows us to build and fetch recipient count/data automatically or on demand. In order to keep the existing behavior the setting is set to TRUE by default where recipient count changed automatically whenever a group is selected against 'Recipient' field.
- For a larger site where mailing group(s) have over 200k contacts, then fetching recipient data automatically is a too expensive operation as it needs to run queries, whenever a mailing group is selected or removed from recipient field, this causes performance issue and leads to the slowness of compose screen. To fix it, you need to disable the new setting which will allow you to rebuild your recipient count and list on demand and the effects will be:
a) There will be a refresh button below recipient field. When the page is initially loaded, the button text will 'Estimate recipient count' as you haven't selected any recipient group.
b) Select one or more mailing groups and click the refresh button, this will trigger underlying angular services to fetch the recipient count and list of 50 contacts as recipient, and will be stored in cache. Using this information, recipient count is changed from '(unkown)' to '~29 recipients'.
c) Now after the rebuild if you select any group, you'll notice that the recipient count is changed back to '(unknown)' as now you need to rebuild the recipient data as its outdated
Please check the screencast in PR https://github.com/civicrm/civicrm-core/pull/11091