fix(release): cleanup temporary torrent files (#839)

* fix(release): cleanup temporary files

* the other file

* backout revert
This commit is contained in:
Kyle Sanderson 2023-04-27 12:43:20 -07:00 committed by GitHub
parent 6e5385a490
commit 1b8f2fce3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View file

@ -426,6 +426,15 @@ func (r *Release) downloadTorrentFile(ctx context.Context) error {
return errFunc return errFunc
} }
func (r *Release) CleanupTemporaryFiles() {
if len(r.TorrentTmpFile) == 0 {
return
}
os.Remove(r.TorrentTmpFile)
r.TorrentTmpFile = ""
}
// HasMagnetUri check uf MagnetURI is set or empty // HasMagnetUri check uf MagnetURI is set or empty
func (r *Release) HasMagnetUri() bool { func (r *Release) HasMagnetUri() bool {
return r.MagnetURI != "" return r.MagnetURI != ""

View file

@ -86,6 +86,7 @@ func (s *service) Process(release *domain.Release) {
return return
} }
defer release.CleanupTemporaryFiles()
ctx := context.Background() ctx := context.Background()
// TODO check in config for "Save all releases" // TODO check in config for "Save all releases"