Skip to content

Commit 8f3af70

Browse files
committed
docs: clean up async section
1 parent 92db4a2 commit 8f3af70

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

docs/core/event_handler/appsync.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,10 +538,7 @@ This is useful when you want to stop processing immediately in the event of an u
538538

539539
#### Async
540540

541-
Choose the asynchronous batch processor when your objective is to leverage concurrency capabilities without the necessity of preserving records in a specific order.
542-
543-
???+ warning
544-
Make sure that preserving the order of the response is not a requirement of your logic.
541+
Similar to `@batch_resolver` explained in [batch resolvers](#batch-resolvers), you can use `async_batch_resolver` to handle async functions.
545542

546543
=== "getting_started_with_batch_async_resolver.py"
547544
```python hl_lines="3 7 17"

examples/event_handler_graphql/src/getting_started_with_batch_async_resolver.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717

1818

19-
def search_batch_posts(posts: list) -> dict[str, Any]:
19+
async def search_batch_posts(posts: list) -> dict[str, Any]:
2020
return {post_id: posts_related.get(post_id) for post_id in posts}
2121

2222

@@ -29,7 +29,7 @@ async def related_posts(event: list[AppSyncResolverEvent]) -> list[Any]: # (1)!
2929
unique_post_ids = list(dict.fromkeys(post_ids))
3030

3131
# Fetch posts in a single batch operation
32-
fetched_posts = search_batch_posts(unique_post_ids)
32+
fetched_posts = await search_batch_posts(unique_post_ids)
3333

3434
# Return results in original order
3535
return [fetched_posts.get(post_id) for post_id in post_ids]

0 commit comments

Comments
 (0)