Time lag between "AddNewMembers" and "ListGroupMembers".

  • 1
  • Problem
  • Updated 10 months ago

Via the EmmaSharp API wrapper, I am adding emails to MEMBERS and GROUPS (i.e., POST /#account_id/members). Once added, I perform a LISTGROUPMEMBERS (i.e., GET /#account_id/groups/#member_group_id/members) as I need to retrieve the MEMBERIDs that have been created. However, there appears to be a time lag between the "add" and what gets listed.

In the example below, I am adding a fifth email to the group. While the EMMA UI correctly displays the 5 members, the LISTGROUPMEMBERS only retrieves 4. If I wait a while and then reissue the LISTGROUPMEMBERS, I get all 5.

What am I doing wrong.?

P.S.
Is this a caching problem (i.e., the POST writes to the EMMA database but the GET reads from a cache)?
Photo of LexisNexis

LexisNexis

  • 20 Posts
  • 2 Reply Likes

Posted 11 months ago

  • 1
Photo of Ben Harrington

Ben Harrington, Employee

  • 112 Posts
  • 12 Reply Likes
Hi There,

There definitely could be a delay when trying to GET members immediately after adding them. Imports run in a queue, so depending on the time of day they could be delayed, and the new members would not be returned in the GET until the import has completed.

When using the POST/#account_id/members, it should return an import ID. If you use GET/#account_id/members/imports/#import_id that should return the status of the import. If the import has completed, then the new members should return when you use GET/#account_id/groups/#member_group_id/members. 

Could you try to add a member to a group and then once you have confirmed that the import has completed, try to use that GET call and see if it returns them? 

I'll be looking out for your reply.

-Ben
Photo of LexisNexis

LexisNexis

  • 20 Posts
  • 2 Reply Likes
I'll run your suggestion to determine the status of the import, but as my screen shot shows, the MEMBERS are correctly displayed in the newly created GROUP yet the GET MEMBERS is incorrect.
Photo of Kyle Gregory | Lipscomb University

Kyle Gregory | Lipscomb University, Champion

  • 99 Posts
  • 69 Reply Likes
Hey LexisNexis,

Through my testing it looks like requests are cached for around 300 seconds (5 minutes). Varnish returns the "age" header and you can see it resets for any call around 300 seconds or so. So that might be what you're running into.

Does that seem to be the case?
Kyle
Photo of LexisNexis

LexisNexis

  • 20 Posts
  • 2 Reply Likes
Thx Kyle.  I've modified my batch process to so that on its next run I gather any "missing" information that should have been returned on the prior AddNewMembers.