Why do cloudflare workers hit CPU time limit early ?

Can someone from the Cloudflare team explain why my worker sometimes fails with the error “Worker exceeded CPU time limit” even though the CPU limit is set to 5 seconds ? I’m on the pro plan, and according to the logs the failure happens after roughly 2 seconds of CPU time. The issue is intermittent, but when it occurs it breaks the user experience. What causes this early limit trigger, and how can it be prevented ?
image.png
image.png
image.png
Was this page helpful?