Skip to content

Commit 7489361

Browse files
Go: Add details on Heartbeating after context cancellation (#3970)
* add blurb about heartbeating after activity cancel * Update cancellation.mdx Minor wordsmithing --------- Co-authored-by: Brian MacDonald <[email protected]>
1 parent 39414c6 commit 7489361

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/develop/go/cancellation.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This pages shows the following:
2020
- How to set an Activity Heartbeat Timeout.
2121
- How to listen for and handle a Cancellation request within an Activity.
2222
- How to send a Cancellation request from a Temporal Client.
23+
- Heartbeating after a Cancellation.
2324

2425
## Handle Cancellation in Workflow {#handle-cancellation-in-workflow}
2526

@@ -132,3 +133,16 @@ func main() {
132133
// ...
133134
}
134135
```
136+
137+
## Heartbeating after a Cancellation
138+
139+
Sometimes you may want to continue running your Activity, even after a Cancellation has been issued.
140+
You may want to completely ignore the cancellation and continue Activity
141+
execution, including Heartbeating, or you may want to send one final Heartbeat after Cancellation.
142+
Even though the context is cancelled when the Workflow is Cancelled, you are still able to send
143+
Activity Heartbeats.
144+
145+
When you call `activity.RecordHeartbeat` after Cancellation has occurred, a
146+
`WARN RecordActivityHeartbeat with error Error context canceled` message will be logged, and a
147+
`context canceled` error will be returned from the call. However, the
148+
Heartbeat **has** still been sent.

0 commit comments

Comments
 (0)