Sending to lists with large segments times out because of mailchimp_test_list_segment

Created on 9 June 2023, about 1 year ago
Updated 14 September 2023, 10 months ago

Problem/Motivation

We were getting a curl timeout error that was only occurring sending to our larger email segments (about 8,000 users). On small internal segments for testing (10 users), the emails sent correctly.

We narrowed it down to the mailchimp_test_list_segment() function. That function times out with large segments and/or segments with lots of fields and details. The error is a CURL error like this:
An error occurred testing a list segment: CURL Error 28: Operation timed out after 10001 milliseconds with 0 bytes recieved

We have a segment with the about 8,000 users and lots of custom fields and preferences and when we isolate the mailchimp API call 'GET/lists/{list_id}/segments/{segment_id}/members' it was taking a long time, longer than 10 seconds which was the timeout error we are seeing in Drupal

This function is called as part of the mailchimp_campaign_save_campaign() function and all it seems to be doing is checking to see if the segment is real. If that is the case, then I don't think it need to be hard-coding a request for 500 members to be returned. Really, you could return one member and confirm that the segment is real.
https://git.drupalcode.org/project/mailchimp/-/blob/2.x/modules/mailchim...

Steps to reproduce

Send a campaign to a segment of an email list, when the segment is very large and with lots of custom fields.
Alternatively, run the 'GET/lists/{list_id}/segments/{segment_id}/members' mailchimp API and confirm it takes longer as you increase the number of emails and fields requested. Eventually, a large enough list will take longer than 10 seconds (and therefore timeout).

Proposed resolution

Reduce the count in mailchimp_test_list_segment() to something smaller, like 10

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.2

Component

Campaign Module

Created by

πŸ‡ΊπŸ‡ΈUnited States j_swope00

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024