Race conditions occur when two servers try to update the status of a contact at nearly the same time. They commonly arise from several factors: multiple triggers set for the same action, actions executing simultaneously for a contact, or automations running at similar times for the same contact. These situations can cause conflicts or unpredictable behaviour in workflows, as the system may try to process overlapping actions at once, leading to unintended outcomes.
Examples:
- Using both the Appointment Status and Customer Booked Appointment triggers for identical functions can create conflicts.
- Simultaneous firing of opportunity changes and appointment triggers within the same workflow.
- Adding a contact tag at the same time across multiple workflows.
Identifying Race Conditions
To check whether you're experiencing a race condition, look at the workflow execution history and timing. Watch for:
- Duplicate messages.
- Workflow history showing a different trigger than intended.
- Tags being added without reflecting on the contact.
- Unexpected behaviour caused by triggers firing at similar times.
Preventing Race Conditions
These strategies can help you avoid race conditions:
Add a Wait Step
Insert a 2-minute wait step before actions that might be affected by race conditions. This gives the system time to process actions correctly.
Use Distinct Triggers
Avoid using the same or similar triggers for the same actions across workflows.
Be Specific with Filters
Tailor your filters to the specific actions a lead might take, reducing the chance of triggers firing simultaneously.
Pass Input Trigger Parameters
When adding a contact to another workflow, use the "Pass Input Trigger Parameters" option with the "Add To Workflow" action to make sure data is passed correctly.
Troubleshooting Tips and Best Practices
If you run into unexpected behaviour, follow these steps:
- Check Enrollment History and Execution Logs: These can give you useful insight into timing and trigger issues.
- Investigate Multiple Workflows: Look for workflows that may fire at the same time due to customer actions.
- Use Unique Trigger-to-Action Implementations: Avoid using multiple workflows for the same actions.