You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is more of a question (apologies if this is the wrong place for this) about what kind of timing expectations can be expected from the API in regards to data syncing. The position I am in is:
Service A sends a request to Service B
In response to the request, Service B sends an email via Transactional
After getting the response from Service B, Service A attempts to query the message_timeline to validate that the email went through (yes Service B likely should handle this)
I have the lookup wrapped in a "try, wait" loop to give the API some time to sync. I also lookup the last send email id (before making the request) to have an anchor to search from. Here is the code (more or less):
tx=Transactional({"api_key": "#######################"})
# get the last sent id before making the requesttimeline=tx.message_timeline(
params={
"group": group
}
)
sent_after_id=timeline[0].MessageID# send the request (blocking)actual_email="foo@bar.com"group="foobar"result=sent_request_to_service_b(actual_email, group)
found=Falseattempts=30wait=10foriinrange(attempts):
timeline=tx.message_timeline(
params={
"group": group,
"sentAfterId": sent_after_id
}
)
sent_emails= [e.Recipientforeintimeline]
found=any([actual_email==eforeinsent_emails])
iffound:
breakelse:
time.sleep(wait)
There are cases where this works (the email is found) on the very first try (i.e. the API is synced within a few seconds at most) and there are times where it takes 100+ seconds of waiting in order for the email to be found. I can go into the web browser and see the email in the Latest emails sent table long before the API resolves it. I am just wondering if there is some kind of rate limiting that is going on or some other magic happening? I ask because the behavior is fairly back and forth, it works on the first try, then it takes 100 seconds, then it works on the first try, etc (all with different emails that were sent the same way in the same time frame).
Everything is running createsend==4.2.7
I'd appreciate any advice you might have. Thanks for working on this api!
The text was updated successfully, but these errors were encountered:
This is more of a question (apologies if this is the wrong place for this) about what kind of timing expectations can be expected from the API in regards to data syncing. The position I am in is:
Transactional
message_timeline
to validate that the email went through (yes Service B likely should handle this)I have the lookup wrapped in a "try, wait" loop to give the API some time to sync. I also lookup the last send email id (before making the request) to have an anchor to search from. Here is the code (more or less):
There are cases where this works (the email is found) on the very first try (i.e. the API is synced within a few seconds at most) and there are times where it takes 100+ seconds of waiting in order for the email to be found. I can go into the web browser and see the email in the
Latest emails sent
table long before the API resolves it. I am just wondering if there is some kind of rate limiting that is going on or some other magic happening? I ask because the behavior is fairly back and forth, it works on the first try, then it takes 100 seconds, then it works on the first try, etc (all with different emails that were sent the same way in the same time frame).Everything is running
createsend==4.2.7
I'd appreciate any advice you might have. Thanks for working on this api!
The text was updated successfully, but these errors were encountered: