Delay removing an NZF file until it's payload file is complete and written to disk.

This will make recovery from crashes more likely.
This commit is contained in:
ShyPike committed 2011-07-17 21:38:16 +02:00
1 parent a01cd34b58
commit 4f163ad979
2 files changed
+9 -1

No files matched your search

+1
View File
@@ -96,6 +96,7 @@ class Assembler(Thread):
logging.error('Fatal error in Assembler', exc_info = True)
break
nzf.remove_admin()
setname = nzf.setname
if nzf.is_par2 and (nzo.md5packs.get(setname) is None):
pack = GetMD5Hashes(filepath)
+8 -1
View File
@@ -200,7 +200,7 @@ class NzbFile(TryList):
""" Load the article objects from disk """
logging.debug("Finishing import on %s", self.subject)
article_db = sabnzbd.load_data(self.nzf_id, self.nzo.workpath)
article_db = sabnzbd.load_data(self.nzf_id, self.nzo.workpath, remove=False)
if article_db:
for partnum in article_db:
art_id = article_db[partnum][0]
@@ -271,6 +271,13 @@ class NzbFile(TryList):
""" Get lowest article number of this file """
return min(self.decodetable)
def remove_admin(self):
""" Remove article database from disk (sabnzbd_nzf_<id>)"""
try:
os.remove(os.path.join(self.nzo.workpath, self.nzf_id))
except:
pass
def __getstate__(self):
""" Save to pickle file, translating attributes """
dict_ = {}