We're building a web app on top of the Amazon Web Services stack, and I'm loving it so far.
We're also making full use of test driven development and that is also proving to be fantastic.
I'm just hoping someone can help me out with an issue I've come across which relates to Amazon SimpleDB's "eventual consistency".
The best example of the issue arising is in a unit test which adds a user and then checks that the user was added successfully by making a call to fetch that newly added user.
I could easily go ahead and just write the tests for that and it could all work fine, but I'm aware of "eventual consistency" and the possibility that when I make the call to fetch the user, the user might not have actually been added yet. Obviously if the fetch user function is called and the user is not in the system, it will return false or failure.
What I'd like to know is what is the best way to handle this? I've seen suggestions of making a function which sleeps for 5 seconds between requests and tries 10 times. I've also seen solutions with exponential backoff. What is the optimal solution?