process: use the unbuffered channel as the done signal

Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
Iceber Gu 2021-04-21 18:24:18 +08:00
parent 34780d67ad
commit 909660ea92

View File

@ -172,7 +172,7 @@ func (p *pidFile) Read() (int, error) {
func waitTimeout(ctx context.Context, wg *sync.WaitGroup, timeout time.Duration) error {
ctx, cancel := context.WithTimeout(ctx, timeout)
defer cancel()
done := make(chan struct{}, 1)
done := make(chan struct{})
go func() {
wg.Wait()
close(done)