Skip to content

Commit 98dbfd4

Browse files
committed
调整 Close 方法
1 parent 532be45 commit 98dbfd4

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

executor.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,14 @@ func (e *Executor) Submit(ctx context.Context, task Task) error {
7777
}
7878
}
7979

80-
// Close closes the executor and returns an error if failed.
81-
func (e *Executor) Close() error {
80+
// Close closes the executor and waits all tasks to be done.
81+
func (e *Executor) Close() {
8282
if !e.closed.CompareAndSwap(false, true) {
83-
return nil
83+
return
8484
}
8585

8686
close(e.done)
8787
close(e.tasks)
8888

8989
e.group.Wait()
90-
return nil
9190
}

limiter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func (l *Limiter) Go(task Task) {
6666
}()
6767
}
6868

69-
// Wait waits all goroutines to be finished.
69+
// Wait waits all tasks to be done.
7070
func (l *Limiter) Wait() {
7171
l.group.Wait()
7272
}

0 commit comments

Comments
 (0)