Skip to content

Commit 5ff6672

Browse files
committed
chore: improve code style
1 parent e4fa86f commit 5ff6672

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

dataloader.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ func (d *dataLoader[K, V]) LoadMap(ctx context.Context, keys []K) map[K]Result[V
127127
for i, ch := range chs {
128128
results[keys[i]] = <-ch
129129
}
130-
131130
return results
132131
}
133132

@@ -136,7 +135,6 @@ func (d *dataLoader[K, V]) Clear(key K) Interface[K, V] {
136135
if d.cache != nil {
137136
d.cache.Remove(key)
138137
}
139-
140138
return d
141139
}
142140

@@ -145,7 +143,6 @@ func (d *dataLoader[K, V]) ClearAll() Interface[K, V] {
145143
if d.cache != nil {
146144
d.cache.Purge()
147145
}
148-
149146
return d
150147
}
151148

@@ -156,7 +153,6 @@ func (d *dataLoader[K, V]) Prime(ctx context.Context, key K, value V) Interface[
156153
d.cache.Add(key, value)
157154
}
158155
}
159-
160156
return d
161157
}
162158

@@ -207,7 +203,6 @@ func (d *dataLoader[K, V]) goLoad(ctx context.Context, key K) <-chan Result[V] {
207203

208204
// Unlock the DataLoader
209205
d.mu.Unlock()
210-
211206
return ch
212207
}
213208

@@ -237,12 +232,8 @@ func (d *dataLoader[K, V]) processBatch(ctx context.Context, keys []K, batchCtx
237232
fmt.Fprintf(os.Stderr, "%v\n%s", err, buf)
238233

239234
for _, chs := range chs {
240-
for _, ch := range chs {
241-
ch <- Result[V]{err: err}
242-
close(ch)
243-
}
235+
sendResult(chs, Result[V]{err: err})
244236
}
245-
return
246237
}
247238
}()
248239

0 commit comments

Comments
 (0)