I have a desktop application that send POST requests to a server where a django app store the results. DB server and web server are not on the same machine and it happens that sometimes the connectivity is lost for a very short time but results in a connection error on some requests:
OperationalError: (2003, "Can't connect to MySQL server on 'xxx.xxx.xxx.xxx' (110)")
On a "normal" website I guess you'd not worry too much: the browser display a 500 error page and the visitor tries again later. In my case loosing info posted by a request is not an option and I am wondering how to handle this? I'd try to catch on this exception, wait for the connectivity to come back (lag is not a problem) and then continue the process. But as the exception can occur about anywhere in the code I'm a bit stuck on how to proceed.
Thanks for your advice.