From e4592be5e660568ceff2d40f086e143a478cceee Mon Sep 17 00:00:00 2001 From: Honza Dvorsky Date: Thu, 24 Aug 2023 11:09:15 +0200 Subject: [PATCH] Docs fix - put group.addTask inside the loop (#156) * Docs fix - put group.addTask inside the loop * Update How to adopt ServiceLifecycle in applications.md --- .../How to adopt ServiceLifecycle in applications.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/ServiceLifecycle/Docs.docc/How to adopt ServiceLifecycle in applications.md b/Sources/ServiceLifecycle/Docs.docc/How to adopt ServiceLifecycle in applications.md index 62a3978..75e6158 100644 --- a/Sources/ServiceLifecycle/Docs.docc/How to adopt ServiceLifecycle in applications.md +++ b/Sources/ServiceLifecycle/Docs.docc/How to adopt ServiceLifecycle in applications.md @@ -129,8 +129,8 @@ struct StreamingService: Service { func run() async throws { await withDiscardingTaskGroup { group in - group.addTask { - for stream in makeStreams() { + for stream in makeStreams() { + group.addTask { await streamHandler(stream.requestStream, stream.responseWriter) } } @@ -191,8 +191,8 @@ struct StreamingService: Service { func run() async throws { await withDiscardingTaskGroup { group in - group.addTask { - for stream in makeStreams().cancelOnGracefulShutdown() { + for stream in makeStreams().cancelOnGracefulShutdown() { + group.addTask { await streamHandler(stream.requestStream, stream.responseWriter) } }