简体   繁体   English

检测同时向服务器调用多个请求

[英]Detect calling multi requests at same time to server

everyone, I have a problem about HTTP requests: I want to detect calling multi requests (to same url) at same time to prevent from calling it.大家,我有一个关于HTTP请求的问题:我想检测同时调用多个请求(到同一个url)以防止调用它。 For example, I have a bug code - a infinite loop (client-side).例如,我有一个错误代码 - 一个无限循环(客户端)。 This code is calling so many requests at same time to server.此代码同时向服务器调用如此多的请求。 I want to prevent that or balance it.我想防止或平衡它。 I don't know that someone has resolved this problem yet.我不知道有人已经解决了这个问题。 Someone can give me some ideas or algorithms for this problem.有人可以给我一些解决这个问题的想法或算法。

Thanks a lot!非常感谢!

If you want to avoid calling too many times the request from the client side, you can use a lodash.throttle or lodash.debounce.如果你想避免从客户端调用太多次请求,你可以使用 lodash.throttle 或 lodash.debounce。 If you want to protect the server from too many requests you can use a pattern called rate limiting.如果您想保护服务器免受过多请求的影响,您可以使用一种称为速率限制的模式。 However, in this case, you should probably fix the infinite loop instead但是,在这种情况下,您应该改为修复无限循环

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM