1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 14:36:47 +00:00

[bug fix] provider is not terminated if premature stop command received

这个提交包含在:
z4yx
2020-05-09 18:42:54 +08:00
父节点 c8e7d29f34
当前提交 38b0156fae
共有 9 个文件被更改,包括 49 次插入27 次删除

查看文件

@@ -155,11 +155,21 @@ func (m *mirrorJob) Run(managerChan chan<- jobMessage, semaphore chan empty) err
var syncErr error
syncDone := make(chan error, 1)
started := make(chan empty, 10) // we may receive "started" more than one time (e.g. two_stage_rsync)
go func() {
err := provider.Run()
err := provider.Run(started)
syncDone <- err
}()
select { // Wait until provider started or error happened
case err := <-syncDone:
logger.Errorf("failed to start provider %s: %s", m.Name(), err.Error())
syncDone <- err // it will be read again later
case <-started:
logger.Debug("provider started")
}
// Now terminating the provider is feasible
select {
case syncErr = <-syncDone:
logger.Debug("syncing done")