mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 11:42:52 +01:00
Fix for RFE #818993, smarter PeriodicFileDownloader.
This commit is contained in:
parent
f28bed51ec
commit
2fb9273518
@ -85,12 +85,17 @@ class ChannelDBHandler(object):
|
||||
|
||||
def die(self):
|
||||
for db in self.dbCache.itervalues():
|
||||
try:
|
||||
db.commit()
|
||||
except AttributeError: # In case it's not an SQLite database.
|
||||
pass
|
||||
try:
|
||||
db.close()
|
||||
except AttributeError: # In case it doesn't have a close method.
|
||||
pass
|
||||
del db
|
||||
|
||||
|
||||
|
||||
class PeriodicFileDownloader(object):
|
||||
"""A class to periodically download a file/files.
|
||||
|
||||
@ -127,6 +132,10 @@ class PeriodicFileDownloader(object):
|
||||
self.lastDownloaded = {}
|
||||
self.downloadedCounter = {}
|
||||
for filename in self.periodicFiles:
|
||||
if self.periodicFiles[filename][-1] is None:
|
||||
fullPathname = os.path.join(conf.dataDir, filename)
|
||||
self.lastDownloaded[filename] = os.stat(fullPathname).st_ctime
|
||||
else:
|
||||
self.lastDownloaded[filename] = 0
|
||||
self.currentlyDownloading = sets.Set()
|
||||
self.downloadedCounter[filename] = 0
|
||||
|
Loading…
Reference in New Issue
Block a user