@@ -58,16 +58,17 @@ struct PoolTests {
58
58
func testConcurrentPushAndIteration( ) async throws {
59
59
let pool = LambdaHTTPServer . Pool < Int > ( )
60
60
let iterations = 1000
61
- var receivedValues = Set < Int > ( )
62
61
63
62
// Start consumer task first
64
- let consumer = Task {
63
+ let consumer = Task { @Sendable in
64
+ var receivedValues = Set < Int > ( )
65
65
var count = 0
66
66
for try await value in pool {
67
67
receivedValues. insert ( value)
68
68
count += 1
69
69
if count >= iterations { break }
70
70
}
71
+ return receivedValues
71
72
}
72
73
73
74
// Create multiple producer tasks
@@ -81,7 +82,7 @@ struct PoolTests {
81
82
}
82
83
83
84
// Wait for consumer to complete
84
- try await consumer. value
85
+ let receivedValues = try await consumer. value
85
86
86
87
// Verify all values were received exactly once
87
88
#expect( receivedValues. count == iterations)
@@ -116,16 +117,17 @@ struct PoolTests {
116
117
let pool = LambdaHTTPServer . Pool < Int > ( )
117
118
let producerCount = 10
118
119
let messagesPerProducer = 1000
119
- var receivedValues = [ Int] ( )
120
120
121
121
// Start consumer
122
- let consumer = Task {
122
+ let consumer = Task { @Sendable in
123
+ var receivedValues = [ Int] ( )
123
124
var count = 0
124
125
for try await value in pool {
125
126
receivedValues. append ( value)
126
127
count += 1
127
128
if count >= producerCount * messagesPerProducer { break }
128
129
}
130
+ return receivedValues
129
131
}
130
132
131
133
// Create multiple producers
@@ -141,7 +143,7 @@ struct PoolTests {
141
143
}
142
144
143
145
// Wait for consumer to complete
144
- try await consumer. value
146
+ let receivedValues = try await consumer. value
145
147
146
148
// Verify we received all values
147
149
#expect( receivedValues. count == producerCount * messagesPerProducer)
0 commit comments