@@ -10,12 +10,22 @@ complete with failure, and ignore the cancel. The one which ignores the cancel s
1010encounter a hard timeout.
1111
1212# Detailed spec
13- * If a worker is told to begin shutdown, activities are immediately notified via
14- a cancel. It must be possible for the user to determine if this cancel was issued
15- by server, or is the result of worker shutdown
13+ * When a worker shutdown is initiated, the activity context isn't canceled until the
14+ graceful shutdown timeout has elapsed
15+ * Graceful shutdown language behavior
16+ * Core based SDKs - when graceful shutdown timeout isn't specified, this is treated as a 0 second timeout
17+ * Note: Core itself treats no graceful shutdown timeout meaning no-timeout, but every lang has logic to
18+ set a 0 second timeout when lang-side timeout not specified
19+ * Go - when graceful shutdown timeout isn't specified, this is treated as a 0 second timeout
20+ * Java - there is no timeout parameter set like Go or Core, but instead after calling ` shutdown() `
21+ a user can call ` workerFactory.awaitTermination(timeout, unit) ` and ` isTerminated() ` to see if the timeout
22+ has passed, then it is up to the user to forcibly shutdown or do something else
23+ * It must be possible for an activity to determine that a worker is being shut down even before graceful timeout elapses
24+ * [ TODO TS] ( https://github.com/temporalio/sdk-typescript/issues/1739 )
25+ * It must be possible for the user to determine whether the activity context cancel was the result of worker shutdown,
26+ or issued by server
27+ * [ TODO Java] ( https://github.com/temporalio/sdk-java/issues/1005 ) - need to add a way for Activities to know when the worker is being shutdown.
1628* Activities may handle the cancel however they like (including continuing running)
17- * Heartbeating is possible while the shutdown process is ongoing
29+ * Heartbeating is possible while the shutdown process is ongoing, both during and after the graceful shutdown period
1830* If all activities complete, shutdown can complete (assuming WFT work is complete too)
19- * SDKs should provide a timeout parameter which, if elapsed, shutdown completes even if
20- there are still running activities. If such activities complete later their response
21- is ignored
31+ * If an activity runs indefinitely and ignores the cancelation, then worker shutdown will hang indefinitely.
0 commit comments