python - 只有在第一个函数设置全局标志后才完成响应
问题描述
我有两个功能。首先执行检查服务器服务 url-checking。功能作为 sanic-scheduler 任务完成,每 2 秒运行一次。
@task(timedelta(seconds=2))
def check_data_status():
...
isProcessed = True
https://github.com/asmodius/sanic-scheduler
第二个是请求处理程序:
def new_answer(request):
...
# we should wait and complete response only after isProcessed = True
response answer
只有在第一个函数new_answer
之后才应该完成响应。isProcessed = True
我怎么能做到。我正在使用 Sanic。
解决方案
推荐阅读
- visual-studio-code - 使用打开文件夹命令启动 VSCode Win 快捷方式
- sql - 如何在 2 个字段上进行旋转
- python - python和R中多项式回归的不同输出
- python - for循环和创建列表的问题
- java - 将 PDF 字符串/byteArray 转换/写入 pdf 文件
- rust - 如何创建一个指定超特征关联类型的特征?
- vba - ADODB Stream 设置为 Nothing 时不清除缓存
- python-3.x - 在颤振安卓应用程序中运行的 Python 脚本
- flutter - 带有循环文本字符串的颤动日历?
- javascript - 选择选项上的数字精度更改