Trytond Async SQS使用SQS异步执行Tryton方法调用
使用 Tryton SQS 异步执行 这个模块,您可以利用 Amazon SQS 和工作线程异步执行 长时间运行 和阻塞的任务。
快速开始
from trytond.modules.async_sqs import async_task
class MyBigReport(Report):
__name__ = 'report.bigreport'
@async_task()
def expensive_method(self, arg1, arg2):
\"\"\" An expensive method which determines your future \"\"\"
# 做一些繁重的工作并得出结果
return your_future
这个模块允许您将重计算任务提交到后台处理,提升系统响应性能。使用时需要注意 SQS 配置以及任务的异步执行。
下载地址
用户评论