java - Google App Engine - how do you handle a DatastoreTimeoutException? -


I created something on Google App Engine, which acts as a backend for an iPhone app. In the app, there are interactions that are pushed into social networks through their APIs. The typical workflow is like this:

  1. User uses the iPhone app to "do something"
  2. The app engine app is notified via HTTP < / Li>
  3. App Engine warns social network which user did "something". If users were checking their profile on that network, their activity will be displayed through the app. Therefore, as long as the user is concerned, what did they do?
  4. The app engine requires some persistence on its side, but when it tries, a datastore time off is thrown away. And now the data is in a funky state.

So what is a good way to handle it? From the nature of the problem I would love to wrap it in "transactions", but there is no way to roll back the roll sent to the social network. So, how do I deal with Gettar Time Expansion? Should I wrap it in a try block and give it another? Is this a good idea for the user to show an error, and then when they try again, then "skip" the social network interaction so that it does not have to be pushed out twice?

"Is there another idea that I am not thinking here? This can happen when you put a unit with many entities or a lot of properties, get or remove, or if the datastore is overloaded or troubled. "

If you are often seeing exceptions, Hopefully because the datastore operation is too big, so trying again is not really helpful. If you are only coding against the risk that an exception can be thrown away, you can try it again (maybe doing something that will do this. But if you can not kill thestost, then you You can say that you work?)

If you want to strengthen the bulletproof, and you can ensure that you run the operation idempotent on the social network, then: / P>

  • A note for yourself Naan that you need to social network operation.
  • If the note failed to store, fail and return the failure.
  • Otherwise, try the social network operation.
  • If successful, delete the note.
  • Take any kind of action or loop to try again any remaining notes in the future.

Of course you have to be a little careful about the response code that gives you back to the iPhone customer, because the success of a request made by the iPhone app is a long can take time. So you want your app engine request to be idempotent, and you probably want to cancel some kind of.

If you get all from the social network, success or failure, and if you should not succeed successfully, then you are in trouble, this is a nonsense API due to which the web server gives you a successful response It does not mean that you get it, so the caller has no way to know that he has succeeded, even if the responsibility for success is born. But this happens.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -