How to estimate ajax request limit?

My user interface is currently wide open.

In particular, there are some elements, each of which can be deleted by the user separately. If the user clicks the delete button several times, the ajax request will be re-run.

Is speed limit a standard practice that I have to implement, or is it normal to give the user wide access to this?

+4
source share
2 answers

First of all, this is a partial client problem, a problem with a partial server. Some standard solutions:

  • configure the interface so that it does not allow the user to send specific actions too often (for example, in JS, to disable abili to send a request to delete one thing twice),
  • server speed limits are usually not required, but may be useful,

Take StackOverflow as an example: when you do a survey, you cannot reassign it again, and when you do, for example When posting comments, you need to wait a couple of seconds between submissions.

As for the mistakes ... Perhaps you are facing one of several problems. For instance:

  • connection problems (lack of connection, closed access connection or very slow connection),
  • restriction of the internal client (for example, the number of simultaneous requests has reached the maximum allowable),
  • others, server-side restrictions (speed limit, request blocking, etc.),
+2
source

You can group user requests in a queue. Then check this queue from time to time for new send requests. In this way, the user interface will add actions to complete, and you will be able to control how often you submit them. You can prevent the addition of an action if it is already in the queue. In addition, this way you can change your code to accept a list of actions to perform.

This is a general description that can be implemented in JavaScript using functions such as setTimeout .

+3
source

Source: https://habr.com/ru/post/1485863/


All Articles