I have a server where I use external 'MySQL', my server suffers a lot of 'ddos' attacks and when there is an attack the server cannot connect with 'MySQL' and some people lose data.
I put it to save in the 'disconnected' and then reset the variables.