Django-background-tasks Windows错误:再次检查后,process_task“挂起”

我注意到,在Windows上运行process_tasks时,它在第二次检查要处理的新任务的循环后往往会挂起。我不确定是什么引起了这个问题。

上下文: 我创建了自定义任务,这些任务将检查一定数量的外部url /端点,以查看服务/网站/ api是否可访问,然后将消息发送到redis服务器,然后将其拉回客户端以进行某些内容的“实时”更新申请状态。

示例:

@background
def check_endpoint(endpoint_lst):
    status_data = {}
    for endpoint in endpoint_lst:
        status_data[endpoint] = check_status(endpoint)
    sync.async_to_sync(channel_layer.group_send)(
        str("notify"),# Channel Name,Should always be string
        {
            "type": "notify",# Custom Function written in the consumers.py
            "status_data": status_data,},}
    time.sleep(60 * 10)
    check_endpoint(endpoint_lst)

在创建新任务时,我再次称其为self,我发现如果使用装饰器重复执行任务,它将始终锁定pid。我也连接到mssql服务器,如果这也有助于了解。我要处理24项任务。在settings.py

中,将ASYNC设置为True,并将线程数量设置为4。

我已经在这个问题上停留了一段时间了,真的可以使用一些帮助。

YYM819364374 回答:Django-background-tasks Windows错误:再次检查后,process_task“挂起”

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3102310.html

大家都在问