We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fcaac97 commit e4ac5f4Copy full SHA for e4ac5f4
Sources/DataLoader/DataLoader.swift
@@ -94,24 +94,8 @@ final public class DataLoader<Key: Hashable, Value> {
94
guard !keys.isEmpty else {
95
return eventLoopGroup.next().makeSucceededFuture([])
96
}
97
-
98
- let promise: EventLoopPromise<[Value]> = eventLoopGroup.next().makePromise()
99
100
- var result = [Value]()
101
102
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
+ return EventLoopFuture.whenAllSucceed(futures, on: eventLoopGroup.next())
115
116
117
/// Clears the value at `key` from the cache, if it exists. Returns itself for
0 commit comments