added mutex lock to avoid race condition in downloader (#5089)

* added mutex lock to avoid race condition in downloader

* Revert "added mutex lock to avoid race condition in downloader"

This reverts commit cc14bf539a7cdf552ffceda3a9aef2949ccac5c2.

* using lock
This commit is contained in:
Enrique Jose Avila Asapche 2022-08-17 14:33:03 +03:00 committed by GitHub
parent 8b34004372
commit 6e18bef60a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -224,10 +224,10 @@ func (d *Downloader) verify() error {
func (d *Downloader) addSegments() error {
logEvery := time.NewTicker(20 * time.Second)
defer logEvery.Stop()
if err := BuildTorrentFilesIfNeed(context.Background(), d.cfg.DataDir); err != nil {
if err := BuildTorrentFilesIfNeed(context.Background(), d.SnapDir()); err != nil {
return err
}
files, err := seedableSegmentFiles(d.cfg.DataDir)
files, err := seedableSegmentFiles(d.SnapDir())
if err != nil {
return fmt.Errorf("seedableSegmentFiles: %w", err)
}