If I unsubscribe a user from a list on MailChimp, when they look at a MailChimp list field on Drupal they see the field as still checked.
In my recent log messages I get:

An error occurred requesting memberinfo for email@example.com in list ***********. "404: Resource Not Found - The requested resource could not be found."

Should we be unchecking the field in this scenario? as if the data cannot be found it is likely because it is not there.

Comments

jafacakes2011 created an issue. See original summary.

zerolab’s picture

Related #2790041: mailchimp_get_memberinfo logs 404 errors when not really an error -- which only hides the warning.
But this needs proper handling

jafacakes2011’s picture

StatusFileSize
new883 bytes

I have been looking into how it now acts given #2790041 is merged

Steps:
1. Subscribe to a list in Drupal
2. See that the checkbox is now checked
3. In MailChimp, unsubscribe my email from the same list
4. Look at the checkbox in Drupal and see it is still checked
5. Clear cache
6. The checkbox is now unchecked

It appears that the issue is with the caching of `mailchimp.module::mailchimp_get_memberinfo()`

I have attached a patch that will resolve this issue but opens further discussion into if we should be caching this or not.

jafacakes2011’s picture

Status: Active » Needs review
StatusFileSize
new5.31 KB

After thinking about this I have decided to add the ability to decide how long you want memberinfo cached. This way existing users won't see a change in functionality, but those having issues can select the expiry time from a dropdown in the MailChimp settings form.

jafacakes2011’s picture

jafacakes2011’s picture

StatusFileSize
new4.05 KB

Uploaded the wrong patch, apologies.

jafacakes2011’s picture

StatusFileSize
new2.03 KB

Fixed an issue when $memberinfo_expire is NULL (see next patch)

jafacakes2011’s picture

StatusFileSize
new4.08 KB

Patch in #7 can be ignored.

glynnr’s picture

StatusFileSize
new4.48 KB

I noticed that 'memberinfo_expire' is never saved to config in the Form submit.

So I've added that and re-rolled the patch against the latest dev as it was not applying cleanly due to 'Update branding; change MailChimp to Mailchimp.'

zerolab’s picture

StatusFileSize
new4.71 KB
new4.28 KB

The 2 previous patches were missing a use statement. Re-rolled

Status: Needs review » Needs work

The last submitted patch, 10: mailchimp-memberlist-cache-2943292-10.v1_7.patch, failed testing. View results

gcb’s picture

Component: General » API
Assigned: Unassigned » wxactly
rob230’s picture

Status: Needs work » Needs review
StatusFileSize
new4.59 KB

Re-rolling patch #10 for mailchimp 2.0.2.

gcb’s picture

Assigned: wxactly » spncr
a.dmitriiev’s picture

I have the same problem and I found out that the cache for member info is invalidated by the module itself when it is needed, but this is done mostly at the time when webhook is triggered. Do you have the webhooks configured? Is it still happening even with webhooks enabled?

I am not sure that the expiration time will fix the problem, because if you select 4 weeks, for example, the wrong information will be displayed until this 4 weeks will pass.

rob230’s picture

No we are not using webhooks. They are configured per audience in Mailchimp yet the module only allows a single webhook hash, so I'm not sure it would help. It also wouldn't help for non-production environments which wouldn't receive the webhooks.

For now I will re-roll the patch again for 2.2.0. If you still want the member info to be cached forever then that would still be the default behaviour with this patch, it just allows changing the expiry time for those that want to periodically refresh the data.

Is there is a way to resolve this without changing the expiry?

r-mo’s picture

Reroll for 3.1.3