@@ -58,16 +58,17 @@ struct PoolTests {
5858 func testConcurrentPushAndIteration( ) async throws {
5959 let pool = LambdaHTTPServer . Pool < Int > ( )
6060 let iterations = 1000
61- var receivedValues = Set < Int > ( )
6261
6362 // Start consumer task first
64- let consumer = Task {
63+ let consumer = Task { @Sendable in
64+ var receivedValues = Set < Int > ( )
6565 var count = 0
6666 for try await value in pool {
6767 receivedValues. insert ( value)
6868 count += 1
6969 if count >= iterations { break }
7070 }
71+ return receivedValues
7172 }
7273
7374 // Create multiple producer tasks
@@ -81,7 +82,7 @@ struct PoolTests {
8182 }
8283
8384 // Wait for consumer to complete
84- try await consumer. value
85+ let receivedValues = try await consumer. value
8586
8687 // Verify all values were received exactly once
8788 #expect( receivedValues. count == iterations)
@@ -116,16 +117,17 @@ struct PoolTests {
116117 let pool = LambdaHTTPServer . Pool < Int > ( )
117118 let producerCount = 10
118119 let messagesPerProducer = 1000
119- var receivedValues = [ Int] ( )
120120
121121 // Start consumer
122- let consumer = Task {
122+ let consumer = Task { @Sendable in
123+ var receivedValues = [ Int] ( )
123124 var count = 0
124125 for try await value in pool {
125126 receivedValues. append ( value)
126127 count += 1
127128 if count >= producerCount * messagesPerProducer { break }
128129 }
130+ return receivedValues
129131 }
130132
131133 // Create multiple producers
@@ -141,7 +143,7 @@ struct PoolTests {
141143 }
142144
143145 // Wait for consumer to complete
144- try await consumer. value
146+ let receivedValues = try await consumer. value
145147
146148 // Verify we received all values
147149 #expect( receivedValues. count == producerCount * messagesPerProducer)
0 commit comments