There's a race condition that can lead to duplicate participation -- and possibly conflicting segmentation -- for a given experiment.
Thread A: Vanity.ab_test(:my_experiment)
Thread B: Vanity.ab_test(:my_experiment)
To prevent this situation:
1) Make the existing (experiment_id, identity) index a unique index.
2) Update the Vanity::Participant code to gracefully handle the dup record failure.
There's a race condition that can lead to duplicate participation -- and possibly conflicting segmentation -- for a given experiment.
Thread A:
Vanity.ab_test(:my_experiment)
Thread B:
Vanity.ab_test(:my_experiment)
To prevent this situation:
1) Make the existing (experiment_id, identity) index a unique index. 2) Update the Vanity::Participant code to gracefully handle the dup record failure.