Race condition for unique program token value

Anonymous
Not applicable

Race condition for unique program token value

Here is my usecase.

There is a program token defined as {{my.invitationUrl}} which is a placeholder in the Campaign -> Flow -> Send Email.

So while triggering the Campaign through REST API, I pass leadId (for example : 123) and value for this token {{my.invitationUrl}} (for example : abcdef).

So when 'Send Email' execution happens for leadId (123) , the email template will have the value 'abcdef'.

Here {{my.invitationUrl}} value is different for each leadId. It's a unique link.

Now I am calling the Trigger Campaign REST API from 5 threads in parallel, with each API call having different leadId and different token {{my.invitationUrl}} value.

Now the 'Send Email' process execution will be in parallel and they all share the common program token.

So my question is, will be there any chance that 'my.invitationUrl' value of one leadId will go in email template of another leadId ?

As it's a common program token and multiple trigger campaign API calls will overwrite this token value.

4 REPLIES 4
Grégoire_Miche2
Level 10

Re: Race condition for unique program token value

Hi Sanjay,

If the value of the token is different for each lead, then IMHO you have a fundamental design issue. You should use a lead field instead of a program token.

And yes, if you are updating the various values through 5 threads in parallel, you have the risk that the data gets mixed, depending on which API endpoints you are using. If you are using this end point, to set the {{my. token and call the campaign simultaneously, you should be safe (Test it, though). If you are using distinct endpoints for the setting of the {{my. token and add the lead to the campaign, you are almost 100% sure to get into trouble.

-Greg

Anonymous
Not applicable

Re: Race condition for unique program token value

Thanks for your response

Yes, we do call http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Campai... and we pass one leadId, token name and distinct token value each time.

{

"input": {

"leads": [

{

"id": <leadId>

}

],

"tokens": [

{

"name": "{{my.invitationUrl}}",

"value": "<distinct url for leadId>"

}

]

}

}

In your opinion it should not create any issue, I will test it out with multiple parallel threads.

SanfordWhiteman
Level 10 - Community Moderator

Re: Race condition for unique program token value

That's fine. There's no race condition.

Anonymous
Not applicable

Re: Race condition for unique program token value

Ok. Thanks Sanford Whiteman​ @Grégoire Michel