File tree Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Expand file tree Collapse file tree 1 file changed +1
-17
lines changed Original file line number Diff line number Diff line change @@ -94,24 +94,8 @@ final public class DataLoader<Key: Hashable, Value> {
94
94
guard !keys. isEmpty else {
95
95
return eventLoopGroup. next ( ) . makeSucceededFuture ( [ ] )
96
96
}
97
-
98
- let promise : EventLoopPromise < [ Value ] > = eventLoopGroup. next ( ) . makePromise ( )
99
-
100
- var result = [ Value] ( )
101
-
102
97
let futures = try keys. map { try load ( key: $0, on: eventLoopGroup) }
103
-
104
- for future in futures {
105
- _ = future. map { value in
106
- result. append ( value)
107
-
108
- if result. count == keys. count {
109
- promise. succeed ( result)
110
- }
111
- }
112
- }
113
-
114
- return promise. futureResult
98
+ return EventLoopFuture . whenAllSucceed ( futures, on: eventLoopGroup. next ( ) )
115
99
}
116
100
117
101
/// Clears the value at `key` from the cache, if it exists. Returns itself for
You can’t perform that action at this time.
0 commit comments