From 6e18bef60ae12b633b472969d1fe3adf58d0127d Mon Sep 17 00:00:00 2001 From: Enrique Jose Avila Asapche Date: Wed, 17 Aug 2022 14:33:03 +0300 Subject: [PATCH] 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 --- cmd/downloader/downloader/downloader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/downloader/downloader/downloader.go b/cmd/downloader/downloader/downloader.go index cb0bb6c92..7b2bfdd36 100644 --- a/cmd/downloader/downloader/downloader.go +++ b/cmd/downloader/downloader/downloader.go @@ -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) }