[workers] CPU time limit unclear
In the workers limits page link it is mentioned for the standard plan the CPU time limit is 30s for a HTTP request.
Questions
1. New paid plans will fall under the
Standard Plan
, right?
2. Does a 30s CPU time mean I can expect the worker to run for atleast 30 seconds? I plan to run a high compute image processing worker and will need it to run for a few seconds1 Reply
CPU time is the amount of time you can spend processing data, it doesn't count the time spent on I/O like fetch calls or returning responses. If you use more than 30 seconds of CPU then the worker execution ends and it returns an error.
The overall duration value is different as it includes I/O, there is not limit on that duration however the Worker will terminate early if the client closes the connection or we push a runtime update and the Worker doesn't end within 30 seconds after:
Cloudflare updates the Workers runtime a few times per week. When this happens, any in-flight requests are given a grace period of 30 seconds to finish. If a request does not finish within this time, it is terminated. While your application should follow the best practice of handling disconnects by retrying requests, this scenario is extremely improbable. To encounter it, you would need to have a request that takes longer than 30 seconds that also happens to intersect with the exact time an update to the runtime is happening. To extend the worker execution after the client has disconnected you can use waitUntil https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/#contextwaituntil Also to question 1: all Workers Paid plans on paygo(non-Enterprise) use the Standard usage model, whether new or old