P
P
paulvales2019-05-10 12:35:59
JavaScript
paulvales, 2019-05-10 12:35:59

Could there be duplicate requests due to bad internet?

Greetings! There is a cross-platform application on jquery mobile, there is a chaotic duplication of entries in the database. In the interface, in order to avoid the human factor, everything is provided. On a back there is a check on a double before records in a DB. But there are still records with an interval of about 4 seconds. What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Proskurin, 2019-05-10
@Vlad_IT

This usually happens because the user sent a request to the server, the request is gone, but the answer has not yet arrived (and the page hangs), the user clicks the "send" button again.
Make tokens that will be unique for each user instance, and from which more than one request cannot be sent (the generation of tokens and their verification must be on the server). Or block the "send" button after the click, and when the answer comes or the timeout passes, unblock it and display the desired message or action. But your back is obviously not working well, not in the way you think.

N
nrgian, 2019-05-10
@nrgian

By itself, no.
But if the Internet is bad, then the user or application may retry. This is natural behavior.
A universal way to fight: a unique ID generated on the client.
The server checks it and, if a duplicate is found, either gives a whack or writes it to the entire same record - and there will be no duplicates.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question