Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions erigon-db/downloader/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1455,17 +1455,19 @@ func (d *Downloader) updateVerificationOccurring() {
func (s *Downloader) Delete(name string) (err error) {
s.lock.Lock()
defer s.lock.Unlock()
// This needs to occur first to prevent it being added again, and also even if it isn't actually
// in the Downloader right now.
err = s.torrentFS.Delete(name)
if err != nil {
s.logger.Log(log.LvlError, "error removing snapshot file torrent", "name", name, "err", err)
}
t, ok := s.torrentsByName[name]
if !ok {
return
}
// Stop seeding. Erigon will remove data-file and .torrent by self
// But we also can delete .torrent: earlier is better (`kill -9` may come at any time)
t.Drop()
err = s.torrentFS.Delete(name)
if err != nil {
s.logger.Log(log.LvlError, "error removing snapshot file torrent", "name", name, "err", err)
}
g.MustDelete(s.torrentsByName, name)
// I wonder if it's an issue if this occurs before initial sync has completed.
delete(s.requiredTorrents, t)
Expand Down
Loading