Skip to content

Commit 5d15598

Browse files
author
Adnan Abdulhussein
committed
block on send to finish goroutine
Signed-off-by: Adnan Abdulhussein <[email protected]>
1 parent efd166e commit 5d15598

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

pkg/restic/exec_commands.go

+1-5
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ func RunRestore(restoreCmd *Command, log logrus.FieldLogger, updateFunc func(vel
192192
// create a channel to signal when to end the goroutine scanning for progress
193193
// updates
194194
quit := make(chan struct{})
195-
var wg sync.WaitGroup
196195

197-
wg.Add(1)
198196
go func() {
199197
ticker := time.NewTicker(restoreProgressCheckInterval)
200198
for {
@@ -211,15 +209,13 @@ func RunRestore(restoreCmd *Command, log logrus.FieldLogger, updateFunc func(vel
211209
})
212210
case <-quit:
213211
ticker.Stop()
214-
wg.Done()
215212
return
216213
}
217214
}
218215
}()
219216

220217
stdout, stderr, err := exec.RunCommand(restoreCmd.Cmd())
221-
close(quit)
222-
wg.Wait()
218+
quit <- struct{}{}
223219

224220
// update progress to 100%
225221
updateFunc(velerov1api.PodVolumeOperationProgress{

0 commit comments

Comments
 (0)