mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add an explicit garbage collection after a news download to ensure unused memory is reclaimed. Useful for people leaving calirbe running 24/7
This commit is contained in:
parent
78d492b554
commit
e3e03aa1a1
@ -5,6 +5,8 @@ __license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import gc
|
||||
|
||||
from PyQt4.Qt import Qt
|
||||
|
||||
from calibre.gui2 import Dispatcher
|
||||
@ -53,11 +55,11 @@ class FetchNewsAction(InterfaceAction):
|
||||
|
||||
def scheduled_recipe_fetched(self, job):
|
||||
temp_files, fmt, arg = self.conversion_jobs.pop(job)
|
||||
pt = temp_files[0]
|
||||
fname = temp_files[0].name
|
||||
if job.failed:
|
||||
self.scheduler.recipe_download_failed(arg)
|
||||
return self.gui.job_exception(job)
|
||||
id = self.gui.library_view.model().add_news(pt.name, arg)
|
||||
id = self.gui.library_view.model().add_news(fname, arg)
|
||||
|
||||
# Arg may contain a "keep_issues" variable. If it is non-zero,
|
||||
# delete all but newest x issues.
|
||||
@ -81,5 +83,6 @@ class FetchNewsAction(InterfaceAction):
|
||||
self.gui.status_bar.show_message(arg['title'] + _(' fetched.'), 3000)
|
||||
self.gui.email_news(id)
|
||||
self.gui.sync_news()
|
||||
gc.collect()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user