Skip to content

Commit 4eea6ec

Browse files
committed
Add explanation for LambdaContext not being Sendable
1 parent 77ad9a5 commit 4eea6ec

File tree

1 file changed

+5
-1
lines changed
  • Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals

1 file changed

+5
-1
lines changed

Sources/AWSLambdaRuntimeCore/Documentation.docc/Proposals/0001-v2-api.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ public protocol LambdaResponseWriter: ~Copyable {
208208
`ByteBufferAllocator`) will be removed.
209209

210210
A new function `addBackgroundTask(_:)` will also be added. This will allow tasks to be run in the background while and after
211-
the response is/has been sent. Please note that `LambdaContext` will not be `Sendable` anymore.
211+
the response is/has been sent. Please note that `LambdaContext` will not be `Sendable` anymore, because in order
212+
to allow adding background tasks in a structured way, the `LambdaContext` will need to be backed with a `TaskGroup`.
213+
Since `TaskGroup` is not `Sendable` we cannot mark `LambdaContext` as `Sendable`. If users need any property out of the
214+
`LambdaContext` they can just extract the property and then pass it around or close over it as all the properties are
215+
`Sendable`.
212216

213217
```swift
214218
/// A context object passed as part of an invocation in LambdaHandler handle functions.

0 commit comments

Comments
 (0)