server-side - 在后台运行任务
问题描述
什么是允许 Web 应用程序在后台处理任务而不让用户等待任务完成的技术。
Example, as a user,
1. I want to submit a form which requires heavy processing. (Assume it requires to checking or actions, upload documentation or etc)
2. After submitting the form, the task will be running in the background, then I can go to other page and do something else.
2.1 At the same time, I might submit another form to the server.
The request can be process at the same time or can be queue under a queue system
3. I will receive a notification from the system whenever the server return a response. (Regardless it is success or failure)
此功能类似于 Google Cloud Platform。
解决方案
尝试Kue或任何其他类似的库。“谷歌”的术语是“[语言]任务队列”
你当然可以自己动手。虽然如果您使用现有的服务器(例如 redis 或 rabbitmq)会容易得多。因此,排队部分由服务器为您处理,您可以专注于您的业务逻辑。
推荐阅读
- python - 如何在 Python 中合并特定列中的特定行
- python - 需要从 Python 中的一行中提取特定模式
- python - ''TensorFlow serving'' 和 ''local model reload'' 的预测结果不同
- android - 需要类型不匹配:集合
找到:列表 ? - linux - 等到预定的“工作”完成然后继续脚本
- swift - 如何在使用 SceneKit 开发的项目中使用 SpriteKit 粒子文件?
- c - 使用指针向数组中的每个元素添加一个数字
- node.js - 我应该使用 webpack 命令还是 webpack-cli 命令?
- flutter - Flutter:在简历上重新进行身份验证
- postgresql - PostgreSQL 如果存在则选择最小未完成时间,否则选择最大完成时间 - 合并查询结果