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

Fix campaign membership syncing when an issue such as api limits occur #7514

Open
wants to merge 5 commits into
base: staging
from

Conversation

Projects
None yet
1 participant
@alanhartless
Copy link
Contributor

commented May 10, 2019

Please be sure you are submitting this against the staging branch.

Q A
Bug fix?
New feature?
Automated tests included?
Related user documentation PR URL
Related developer documentation PR URL
Issues addressed (#s or URLs)
BC breaks?
Deprecations?

Description:

This addresses two issues:

  1. If for some reason the contact was deleted but a reference to the SF still in the integration_entity table, it was not possible to pull that contact back in through a campaign membership based segment.
  2. If an API limit was hit during fetching unknown contacts from SF during the middle of a campaign member segment sync, it would halt the campaign membership sync because the current date/time was cached as the last time a successful sync occurred so the next sync would only add contacts added to the campaign since then.

Steps to reproduce the bug:

1.1 Setup Salesforce and create a segment for campaign membership. Run the mautic:segment:update command to build the segment.
1.2 Go to the leads table in the database and manually delete the contacts just pulled from SF (leaving the entries in the integration_entities table intact
1.3 Run the segment command again and notice that the contacts are not recreated with the segment sync
2.1 Edit https://github.com/mautic/mautic/blob/staging/plugins/MauticCrmBundle/Integration/SalesforceIntegration.php#L8886 and add throw new ApiErrorException('test'); right after try {
2.2 Go to the cache_items table and delete the entry like Salesforce:Salesforce.CampaignSync.7010M000000naKGQAY where 7010... matches the campaign ID
2.3 Add another contact or lead to the SF campaign (in salesforce) that doesn't exist in Mautic already then repeat 2.3. Notice that even though an exception was thrown when fetching contacts from the SF campaign, a new datetime is cached in cache_items.

Steps to test this PR:

  1. Repeat and contacts will be re-added to Mautic
  2. Repeat and no date/time will be cached to cache_items allowing the next job to retry the campaign sync

alanhartless added some commits Apr 25, 2019

Fixed issue that caused date/time to be cached for campaign membershi…
…p when something in fetching unknown contacts fails such as an api limit error (in getLeads)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.