Search code examples
google-cloud-platformgoogle-tasks

How to create Google Cloud task sheduled on time?


I need to create Google cloud task with long time of retry (a year for example), this will be simple post request to endpoint of my application. I created task with

       const task = {
            ...
            scheduleTime: {
                      seconds: expirationAtSeconds,
            }
        }
       const [response] = await this.taskClient.createTask(request);

Task created successfully, but I want to delay for next execution at 17202815 seconds, this means task must raise 2024-12-01, but task run immediately in seconds, not how I expected. What I doing wrong?

More common question - How I can use Cloud Tasks to schedule a function execution on a delay?


Solution

  • Posting my previous comment as an answer.

    Adding to @guillaumeblaquiere's comment:

    Based on this documentation on Cloud Tasks quotas and limits, the maximum scheduled time for a task is 30 days.

    I would suggest following this workaround wherein 2 cloud tasks were created and the second one will be triggered once the first task reached the max schedule time.