Add option to set dispatch_deadline for the task?
Closed this issue · 4 comments
According to the documentation, the Cloud Task has a dispatch_deadline option. Default (for HTTP tasks) is 10 minutes.
In this package, I see no option to set this option. I do see that this config option was deleted in the past, but could not really find out why.
The reason I open this issue: I just got a "DEADLINE_EXCEEDED" error on my task, which was running longer than 10 minutes. The client that was called runs on cloud run and has a timeout of 30 minutes. This timeout was not hit.
Can you clarify why the dispatch_deadline was removed and how I can set this option with the current version? I would like to tell google that my task runs longer than 10 minutes, but I cannot seem to find the possibility to do so (I would expect it somewhere in CloudTasksQueue::pushToCloudTasks()).
Thanks in advance for your answer!
Hey, I think I removed that option because I thought it no longer necessary, because job timeouts could already be handeled by the $timeout option. But now I understand changing the dispatch_deadline is in fact necessary if tasks need to run longer than the default 10 minutes. I think somewhere next week/in the coming weeks I can add it back, but feel free to make a PR if you need it faster!
Thank you for your reply. To be honest, I have kind of hacked it into our project where we needed it, so I'm no in that big of a hurry.
Also, I'm wondering if you are thinking of just adding the config option again, or perhaps want to make this a bit more flexible, so it can be set per job perhaps? A bit like how the handler url or headers can be set per job.
On the other hand, a (high value) config works for all the jobs of course, but I can imagine that some might want to set this timeout per job. For me, using 1 (high value) config value works, because my endpoint is a cloudrun service, which has a (separate) timeout.
I'm more than happy to make a PR for this, but I don't have a lot of time in the next few weeks (either).
I found a bit of time and have opened a PR: #178
I decided to simply have a config value (per cloud tasks queue). Let me know what you think of it, or if you have any feedback.
Released in v5.0.1.