What is the min and max of cron schedule? And how long the cron can run? 24 hours? The below code work with schedule is 1 minutes.
cron:
- description: test
url: /test
schedule: every 1 minutes
But I want to make it 30 seconds
So I wrote
cron:
- description: test
url: /test
schedule: every 30 seconds
But it just return error when I update the app.
Cron does not support granularity of less than one minute. As for how long would the cron in GAE would run, the docs said:
An HTTP request invoked by cron can run for up to 10 minutes, but is subject to the same limits as other HTTP requests.
This suggest to me that cron requests is treated the same with task queue requests. Requests to a frontend instance has 10 minute to finish executing, while requests to backend have a 24-hour deadline.
Edit:
If you really need 30 second granularity on your cron, a bit of a workaround is possible by exploiting the countdown
property of the Task in TaskQueue. The steps are as follows:
countdown
property.Alternatively, you could precompute the intended ETA at 30 seconds and 60 seconds from the start of the servlet, and put it in the eta
property instead for a better granularity.
A final caveat, the eta
and countdown
does not guarantee that the task would be executed at exactly the prescribed time. If your queue is saturated, or your instances are overloaded, some delay could be expected.