mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Add way to invalidate discovery cache
This commit is contained in:
parent
fe1d512b38
commit
acf3ac0dcd
2 changed files with 8 additions and 1 deletions
|
|
@ -8,3 +8,7 @@ __version__ = pkg_resources.get_distribution('vdirsyncer').version
|
||||||
|
|
||||||
PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer'
|
PROJECT_HOME = 'https://github.com/untitaker/vdirsyncer'
|
||||||
DOCS_HOME = 'https://vdirsyncer.readthedocs.org/en/latest'
|
DOCS_HOME = 'https://vdirsyncer.readthedocs.org/en/latest'
|
||||||
|
|
||||||
|
# Increase whenever upgrade potentially breaks discovery cache and collections
|
||||||
|
# should be re-discovered
|
||||||
|
discovery_cache_version = 1
|
||||||
|
|
|
||||||
|
|
@ -145,10 +145,13 @@ def get_status_name(pair, collection):
|
||||||
|
|
||||||
|
|
||||||
def _get_collections_cache_key(pair_options, config_a, config_b):
|
def _get_collections_cache_key(pair_options, config_a, config_b):
|
||||||
|
from vdirsyncer import discovery_cache_version
|
||||||
m = hashlib.sha256()
|
m = hashlib.sha256()
|
||||||
j = json.dumps([
|
j = json.dumps([
|
||||||
|
discovery_cache_version,
|
||||||
pair_options.get('collections', None),
|
pair_options.get('collections', None),
|
||||||
config_a, config_b
|
config_a,
|
||||||
|
config_b
|
||||||
], sort_keys=True)
|
], sort_keys=True)
|
||||||
m.update(j.encode('utf-8'))
|
m.update(j.encode('utf-8'))
|
||||||
return m.hexdigest()
|
return m.hexdigest()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue