Django同步函数:等待一个会话以使用函数完成
在我的Django服务器中,我具有一个可以处理用户请求的函数。当多个用户同时从各自的会话中发送请求时,该函数会在其自己的会话中处理请求,因此并行进行。但是我想确保当我有多个用户的多个请求时,他们会被一个一个一个而不是同时处理。基本上,我不希望此功能是会话实例,而是一个只有一个用户一次可以使用的全局函数。我该如何解决这个问题?这是一个开放式的问题,只要我们在实施中使用Django,我就没有更多的约束。
In my django server, I have a function that handles a request from a user. When multiple users are sending requests from within their respective sessions at the same time, the function processes the requests within their own sessions so it happens in parallel. But I want to ensure that when I have multiple requests from multiple users, they are handled one by one rather than simultaneously. Basically, I don't want this function to be a session instance but a global function that only one user can use at a time. How can I solve this problem? This is an open-ended question so as long as we are using Django in the implementation I don't have any more constraints.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论