You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Activity Execution Info to support checking if heartbeat details from previous attempt are available (#41)
### Motivation
Currently, we offer `heartbeatDetails(as:)` method to retrieve the
activity details of an activity execution. If it's the first attempt,
this method fails with an ArgumentError `Mismatched number of values and
payloads` as there are no heartbeat details available. The user has no
way to differentiate between no heartbeat details being available or
that they did indeed supple the wrong amount of payload types.
### Modifications
We have `heartbeatDetails(as:)` return an optional tuple instead, so
users can check if there are heartbeat details available from previous
activity attempts.
### Test Plan
Augmented existing unit tests to check activity details to be present or
not.
Copy file name to clipboardExpand all lines: Sources/Temporal/Worker/Activities/ActivityExecutionContext.swift
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -191,16 +191,20 @@ public struct ActivityExecutionContext: Sendable {
191
191
///
192
192
/// - Parameter detailTypes: The types to convert the heartbeat details to, specified as
193
193
/// variadic generic parameters.
194
-
/// - Returns: A tuple containing the converted heartbeat details in the order specified.
194
+
/// - Returns: A tuple containing the converted heartbeat details in the order specified. Returns `nil` if there are no heartbeat details available from a previous activity attempt.
195
195
/// - Throws: Conversion errors if the number of types doesn't match the stored details or if
0 commit comments