程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误??

开发过程中遇到为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?的问题如何解决?下面主要结合日常开发的经验,给出你关于为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?的解决方法建议,希望对你解决为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?有所启发或帮助;

我将 Google-cloud-tasks==2.2.0 与 Flask Gunicorn 一起使用。这就是我将任务发送到队列的方式:

def send_task(payload,queue,uri,*args):
    url = f'https://www.mywebsite.com/{uri}'
    payload = Json.dumps(payload)
    payload = payload.encode()
    parent = clIEnt.queue_path(project=project,LOCATIOn=LOCATIOn,queue=queuE)
    service_account_email = 'myaccount.com'
    # Construct the request body.
    td = '1800s'
    duration = duration_pb2.Duration()
    time = duration.FromJsonString(td)

    Now = datetiR_286_11845@e.utcNow() + timedelta(seconds=10)
    ts = timestamp_pb2.timestamp()
    Now = ts.FromdatetiR_286_11845@e(Now)

    task = {
        'http_request': {  # Specify the type of request.
            'http_method': tasks_v2beta3.httpR_286_11845@ethod.POST,'url': url,'body': payload,# Convert Dictionary to String
            'headers': { # Add custom header
                'Content-Type': 'application/Json'
            },'oIDc_token': {'service_account_email': service_account_email}
        }
    }
    task['schedule_time'] = Now
    task['dispatch_deadline'] = time
    response = clIEnt.create_task(request={"parent": parent,"task": task},timeout=30.0)

我使用 dispatch_deadline,它应该支持 30 分钟超时,使用 this API reference。

但无论我如何尝试,我的任务都会在 60 秒后失败并出现 504 DEADliNE_EXCEEDED 错误。

老实说,这是我在这里遗漏的必要内容,还是一个错误?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

@H_616_29@

大佬总结

以上是大佬教程为你收集整理的为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?全部内容,希望文章能够帮你解决为什么 Cloud Tasks 会在 60 秒后出现“Deadline Exceeded”错误?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。