Browser request timeout resend

the front end sends an ajax request, and the background response is too slow, resulting in two pieces of data being inserted into the database.
the front end uses the hybrid application APP, to send requests using the $.ajax () method of zepto.js, the background uses java development, and the server uses Tomcat.
frontend access backend interface, backend access intermediate service interface, intermediate service access bank service interface (don"t ask me why)
due to poor connection between our service and intermediate service or intermediate service and banking service, the ajax request sent by the frontend waits for a callback to enter error after one minute, indicating that the user failed to connect to the server
but two payment records appear in the backend database. The interval is mostly one minute, and one is tens of milliseconds
ask for advice

Apr.02,2021

1. To avoid repeated form submission, use flag to control or set disable
2. You can also do Filter in the background
3. Set the network load effect this is that the click page is invalid


it is estimated to be $. Ajax sets the timeout by default, after which a timeout exception is returned.
at this time, the backend does not know and is still executing. Maybe 10 seconds later, the background processing is finished, the database is inserted and the response is returned. The front end has already cancelled the monitoring of the response.


may be a problem with the backend. I guess the request timed out and then automatically retried, but the rollback processing was not done well

Menu