Skip to content

Commit 98087c1

Browse files
author
kuba--
committed
Remove internal _done_ channel.
Signed-off-by: kuba-- <[email protected]>
1 parent 93fbd63 commit 98087c1

File tree

2 files changed

+2
-13
lines changed

2 files changed

+2
-13
lines changed

repository_pool.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ type rowRepoIter struct {
272272
iter RowRepoIter
273273
session *Session
274274
ctx *sql.Context
275-
done chan struct{}
276275
}
277276

278277
// NewRowRepoIter initializes a new repository iterator.
@@ -303,7 +302,6 @@ func NewRowRepoIter(
303302
iter: iter,
304303
session: s,
305304
ctx: ctx,
306-
done: make(chan struct{}),
307305
}
308306

309307
return &repoIter, nil
@@ -324,21 +322,18 @@ func (i *rowRepoIter) Next() (sql.Row, error) {
324322
repo, err := i.repositoryIter.Next()
325323
if err != nil {
326324
if err == io.EOF {
327-
close(i.done)
328325
return nil, io.EOF
329326
}
330327

331328
if i.session.SkipGitErrors {
332329
continue
333330
}
334331

335-
close(i.done)
336332
return nil, err
337333
}
338334

339335
i.currRepoIter, err = i.iter.NewIterator(repo)
340336
if err != nil {
341-
close(i.done)
342337
return nil, err
343338
}
344339
}
@@ -355,7 +350,6 @@ func (i *rowRepoIter) Next() (sql.Row, error) {
355350
continue
356351
}
357352

358-
close(i.done)
359353
return nil, err
360354
}
361355

repository_pool_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,18 +356,13 @@ func testCaseRepositoryErrorIter(
356356
for {
357357
_, err := repoIter.Next()
358358
if err != nil {
359+
cancel()
359360
break
360361
}
361362
}
362363
}()
363364

364-
select {
365-
case <-repoIter.done:
366-
case <-repoIter.ctx.Done():
367-
368-
}
369-
370-
cancel()
365+
<-repoIter.ctx.Done()
371366
}
372367

373368
func TestRepositoryErrorIter(t *testing.T) {

0 commit comments

Comments
 (0)