I have an API which is used by a mobile app to create user profiles. It seems that occasionally the app is timing out and displays an error message but the server continues to create the profile. The result is that we have a few duplicate profiles.
I'm thinking that, as a 'quick fix' that doesn't require a complete re-architecture I could try setting the execution time of the PHP script to match the timeout limit in the app. My question is, if this time limit is reached, can I somehow execute an 'undo changes to the database' script, either automatic, or one I specify?
I know I should really be looking more into why the PHP is reaching timeout limit at all (it's a couple of minutes!), but I have already tweaked bits on the server, and mostly the execution time is just a few milliseconds. There are only a few cases of the timeout occurring. For the one example I'm looking at the minute the user is based in Israel. Is the network connectivity bad in Israel? Can anyone think of anything that could cause the behaviour I'm experiencing?