Skip to content

Commit e4592be

Browse files
authored
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
1 parent 2becb24 commit e4592be

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/ServiceLifecycle/Docs.docc/How to adopt ServiceLifecycle in applications.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ struct StreamingService: Service {
129129

130130
func run() async throws {
131131
await withDiscardingTaskGroup { group in
132-
group.addTask {
133-
for stream in makeStreams() {
132+
for stream in makeStreams() {
133+
group.addTask {
134134
await streamHandler(stream.requestStream, stream.responseWriter)
135135
}
136136
}
@@ -191,8 +191,8 @@ struct StreamingService: Service {
191191

192192
func run() async throws {
193193
await withDiscardingTaskGroup { group in
194-
group.addTask {
195-
for stream in makeStreams().cancelOnGracefulShutdown() {
194+
for stream in makeStreams().cancelOnGracefulShutdown() {
195+
group.addTask {
196196
await streamHandler(stream.requestStream, stream.responseWriter)
197197
}
198198
}

0 commit comments

Comments
 (0)