mirror of
https://github.com/swift-server/swift-service-lifecycle
synced 2026-11-22 04:30:45 +00:00
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
This commit is contained in:
1 parent
2becb2433a
commit
e4592be5e6
1 file changed
+4
-4
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user