mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Reduce metadata source plugin updates interval
Also touch the cache file even when there are no changes to avoid excessive queries.
This commit is contained in:
parent
b9eea6b91c
commit
959583bcc2
@ -20,7 +20,7 @@ from calibre.utils.https import get_https_resource_securely
|
|||||||
|
|
||||||
cache = JSONConfig('metadata-sources-cache.json')
|
cache = JSONConfig('metadata-sources-cache.json')
|
||||||
|
|
||||||
UPDATE_INTERVAL = 24 * 60 * 60
|
UPDATE_INTERVAL = 12 * 60 * 60
|
||||||
|
|
||||||
current_search_engines = builtin_search_engines
|
current_search_engines = builtin_search_engines
|
||||||
|
|
||||||
@ -113,6 +113,7 @@ def main(report_error=prints, report_action=prints):
|
|||||||
'Failed to get metadata sources hashes with error: {}'.format(as_unicode(e)))
|
'Failed to get metadata sources hashes with error: {}'.format(as_unicode(e)))
|
||||||
return
|
return
|
||||||
if not needed:
|
if not needed:
|
||||||
|
cache.touch()
|
||||||
return
|
return
|
||||||
updated = {}
|
updated = {}
|
||||||
for name, expected_hash in needed.iteritems():
|
for name, expected_hash in needed.iteritems():
|
||||||
|
@ -292,6 +292,12 @@ class XMLConfig(dict):
|
|||||||
except EnvironmentError:
|
except EnvironmentError:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def touch(self):
|
||||||
|
try:
|
||||||
|
os.utime(self.file_path, None)
|
||||||
|
except EnvironmentError:
|
||||||
|
pass
|
||||||
|
|
||||||
def raw_to_object(self, raw):
|
def raw_to_object(self, raw):
|
||||||
return plistlib.readPlistFromString(raw)
|
return plistlib.readPlistFromString(raw)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user