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):
|
def die(self):
|
||||||
for db in self.dbCache.itervalues():
|
for db in self.dbCache.itervalues():
|
||||||
db.commit()
|
try:
|
||||||
db.close()
|
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
|
del db
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PeriodicFileDownloader(object):
|
class PeriodicFileDownloader(object):
|
||||||
"""A class to periodically download a file/files.
|
"""A class to periodically download a file/files.
|
||||||
|
|
||||||
@ -127,7 +132,11 @@ class PeriodicFileDownloader(object):
|
|||||||
self.lastDownloaded = {}
|
self.lastDownloaded = {}
|
||||||
self.downloadedCounter = {}
|
self.downloadedCounter = {}
|
||||||
for filename in self.periodicFiles:
|
for filename in self.periodicFiles:
|
||||||
self.lastDownloaded[filename] = 0
|
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.currentlyDownloading = sets.Set()
|
||||||
self.downloadedCounter[filename] = 0
|
self.downloadedCounter[filename] = 0
|
||||||
self.getFile(filename)
|
self.getFile(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user