mirror of
https://github.com/rclone/rclone.git
synced 2024-11-25 01:44:41 +01:00
core: Fix race detected by go race detector
This commit is contained in:
parent
a75bc0703f
commit
e09ef62d5b
@ -4,7 +4,6 @@ package fs
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -225,12 +224,10 @@ func Copier(in ObjectPairChan, fdst Fs, wg *sync.WaitGroup) {
|
||||
func DeleteFiles(to_be_deleted ObjectsChan) {
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(Config.Transfers)
|
||||
var fs Fs
|
||||
for i := 0; i < Config.Transfers; i++ {
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
for dst := range to_be_deleted {
|
||||
fs = dst.Fs()
|
||||
if Config.DryRun {
|
||||
Debug(dst, "Not deleting as --dry-run")
|
||||
} else {
|
||||
@ -247,8 +244,7 @@ func DeleteFiles(to_be_deleted ObjectsChan) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
Log(fs, "Waiting for deletions to finish")
|
||||
Log(nil, "Waiting for deletions to finish")
|
||||
wg.Wait()
|
||||
}
|
||||
|
||||
@ -520,7 +516,6 @@ func Purge(f Fs) error {
|
||||
}
|
||||
} else {
|
||||
DeleteFiles(f.List())
|
||||
log.Printf("Deleting path")
|
||||
Rmdir(f)
|
||||
}
|
||||
return nil
|
||||
|
@ -3,6 +3,12 @@ Remove FIXME skipping directory
|
||||
Change lsd command so it doesn't show -1
|
||||
* Make sure all Fses show -1 for objects Zero for dates etc
|
||||
|
||||
Make unit tests for the fses
|
||||
* Make them try to load a TestFSName config
|
||||
* Then do a proper unit test of each one
|
||||
* If there is no TestFSName config it should exit quietly
|
||||
* However the Local FS should default to a tmpdir
|
||||
|
||||
Todo
|
||||
* FIXME: More -dry-run checks for object transfer
|
||||
* Might be quicker to check md5sums first? for swift <-> swift certainly, and maybe for small files
|
||||
|
Loading…
Reference in New Issue
Block a user