After a quick look at the code it seems like this module will try to send data to Mailchimp and if that communication fails for any reason then that data is just lost.

For example in mailchimp_cron() it has this:

<?php
  if ($item = $queue->claimItem()) {
    call_user_func_array($item->data['function'], $item->data['args']);
    $queue->deleteItem($item);
  }
?>

Shouldn't it be something like this (note that this is nonsense code to illustrate my point, not working code)?:

<?php
  if ($item = $queue->claimItem()) {
    $result = call_user_func_array($item->data['function'], $item->data['args']);
    // If the Mailchimp communication was successful then delete the item from the queue.
    // Otherwise the item will stay in the queue and will be tried again later.
    if ($result->success) {
      $queue->deleteItem($item);
    }
  }
?>

So that if something fails then it tries again later so you don't get lost data?

If something continually fails it's up to the admin to address those failure messages.
Also this module could potentially provide a list of items that have failed more than once or something.

It would be also good to have this built into instant communications (when variable_get('mailchimp_cron', FALSE) == TRUE) so that if the instant transaction fails then it is added to the cron queue.

This whole re-try thing could be a configuration option that can be disabled if anyone didn't want it for some reason.

Comments

angel.angelio’s picture

+1

helmo’s picture

Good idea. I had just added a number of related issue to #2375119: Error opening socket ssl://us2.api.mailchimp.com:443 put back in the queue when I found this.

Hope someone finds the time to do it.

ruscoe’s picture

Status: Active » Closed (won't fix)

We're going to be ending support for the 7.x-3.x branch due to the upcoming deprecation of the v2.0 MailChimp API. If you're still interested in this feature, please feel free to reopen for the 7.x-4.x branch.

rooby’s picture

Version: 7.x-3.2 » 7.x-4.x-dev
Status: Closed (won't fix) » Active

Based on a quick look at the code it seems my code snippets in the original post are still relevant.

Definitely still interested in this as it is a pretty important feature.

Greg Boggs’s picture

Feel free to create a patch with your code if you're interested in getting this feature added to MailChimp. Here's more information: https://www.drupal.org/node/707484

samuel.mortenson’s picture

Status: Active » Closed (won't fix)

We’re in maintenance-mode for the Drupal 7 releases of Mailchimp, so only bug fixes can be committed going forward. Any new features should be developed for the Drupal 8 releases of Mailchimp. Thanks!

rooby’s picture

Version: 7.x-4.x-dev » 7.x-5.x-dev
Category: Feature request » Bug report
Priority: Normal » Major
Status: Closed (won't fix) » Active

Although I was the person who originally filed this as a feature request, I have no idea why I would have done so.

I would say this is definitely a bug, since it is a case of lost data when there is a broken transmission. Sites could be unknowingly missing out on mailing list subscribers.

It's probably major, due to:

"(Lost user input, e.g. a failed form submission, is not the same thing as data loss and in most cases is major)" - From the priority handbook docs.

This is still valid for the 5.x branch.

There is a patch in the related ticket for the D8 branch, which once committed could be used for back-porting.