Php 如何编辑谷歌云任务';默认超时(使用http目标,而不是应用程序引擎)?
我正在使用添加谷歌云任务到我的项目,它的工作非常完美。问题是,我不知道如何增加http目标请求超时?任务对象的Php 如何编辑谷歌云任务';默认超时(使用http目标,而不是应用程序引擎)?,php,google-cloud-tasks,Php,Google Cloud Tasks,我正在使用添加谷歌云任务到我的项目,它的工作非常完美。问题是,我不知道如何增加http目标请求超时?任务对象的分派\u deadline属性应该允许您延长请求超时。HTTP目标的默认值为10分钟 如果要使用nodejs创建任务,请使用dispatchDeadline。 资料来源: 实施示例: //npm安装--save@google cloud/tasks const client=new CloudTasksClient(); const project='您的项目名称'; const que
分派\u deadline
属性应该允许您延长请求超时。HTTP目标的默认值为10分钟
如果要使用nodejs创建任务,请使用
dispatchDeadline
。
资料来源:
实施示例:
//npm安装--save@google cloud/tasks
const client=new CloudTasksClient();
const project='您的项目名称';
const queue='您的队列名称';
常量位置='us-central1';
const parent=client.queuePath(项目、位置、队列);
const ServiceAccount电子邮件地址:user@projectname_or_whatever.iam.gserviceaccount.com';
常量url=http://destination_url'
const payload=JSON.stringify({“user”:“Manuel Solalinde”,'mode':'secret mode'})
const body=Buffer.from(payload.toString('base64'))
//任务创建文档:https://googleapis.dev/nodejs/tasks/latest/google.cloud.tasks.v2beta3.Task.html
常量任务={
httpRequest:{
httpMethod:'POST',
url:url,
调度截止时间:30*60,//30分钟
身体:身体,,
标题:{“内容类型”:“应用程序/json”},
奥德克特肯:{
serviceAccountEmail,
},
},
};
//发送创建任务请求。
log('Sending task:');
const[response]=wait client.createTask({parent,task});
log(`Created task${response.name}`);
当然,我正在更新答案