From 42a1701c5d026b6c46fd9b13a11569a9fcdf2fb0 Mon Sep 17 00:00:00 2001 From: Lenny Chen Date: Tue, 28 Apr 2026 19:23:44 -0700 Subject: [PATCH] docs: add Activity Heartbeat tip for long-running Activities on serverless Co-Authored-By: Claude Opus 4.6 (1M context) --- docs/encyclopedia/workers/serverless-workers.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/encyclopedia/workers/serverless-workers.mdx b/docs/encyclopedia/workers/serverless-workers.mdx index c15602b48d..c7fdc79ef3 100644 --- a/docs/encyclopedia/workers/serverless-workers.mdx +++ b/docs/encyclopedia/workers/serverless-workers.mdx @@ -153,6 +153,13 @@ If your Worker handles long-running Activities, set these three values together: - **Invocation deadline > longest Activity runtime + shutdown deadline buffer.** Set on the compute provider to give each invocation enough total runtime. + :::tip + + If your longest-running Activity runs longer than half the maximum invocation deadline, this constraint may be difficult or impossible to meet. + In this case, use [Activity Heartbeats](/activity-heartbeat) to record the state of the Activity execution so that the next retry can pick up where it left off. + + ::: + For example, if your longest Activity runtime is 5 minutes, and your shutdown hooks take 3 seconds to run, set the Worker stop timeout to more than 5 minutes, and the shutdown deadline buffer to more than 303 seconds (5 minutes + 3 seconds). Set your invocation deadline to at least 10 minutes and 3 seconds (5 minutes + 303 seconds).