Skip to content

Commit

Permalink
Fix mailchimp mlist.members iterations (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudoramariei authored Jul 26, 2023
1 parent 9e6ab58 commit a47d0ab
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/paul_api/plugin_mailchimp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ def retrieve_lists_data(client: MailChimp):
# # Sync list members
list_members = client.lists.members.all(list_id=mlist['id'], get_all=True)

for member in list_members['members']:
list_members_creation_queue = []
list_members_update_queue = []
list_members_creation_queue = []
list_members_update_queue = []

for member in list_members['members']:
member['audience_name'] = mlist['name']
audience_members_exists = Entry.objects.filter(
table=audience_members_table, data__id=member['id'], data__audience_id=mlist['id'])
Expand Down Expand Up @@ -406,8 +406,8 @@ def retrieve_lists_data(client: MailChimp):
Entry.objects.bulk_update(list_members_update_queue, ["data"], batch_size=50)
list_members_update_queue = []

Entry.objects.bulk_create(list_members_creation_queue, batch_size=50)
Entry.objects.bulk_update(list_members_update_queue, ["data"], batch_size=50)
Entry.objects.bulk_create(list_members_creation_queue, batch_size=50)
Entry.objects.bulk_update(list_members_update_queue, ["data"], batch_size=50)

return success, stats

Expand Down

0 comments on commit a47d0ab

Please sign in to comment.