【发布时间】:2021-02-16 13:17:33
【问题描述】:
当我通过我的烧瓶应用程序调用 api 时,我收到代码为 H12 的 heroku 超时错误。 api 通常会在 2 分钟内响应。我通过不同的线程调用 api,以便主烧瓶应用程序线程继续运行。
with ThreadPoolExecutor(max_workers=5) as executor:
future = executor.submit(shub_api, website, merchant.id)
result = future.result()
Heroku 上有一些关于运行后台任务的文档,但是 python 示例用于使用我一无所知的 Redis。这个问题还有其他解决方案吗?
【问题讨论】:
标签: python flask heroku python-multiprocessing python-multithreading