Skip to content

Commit

Permalink
Merge pull request #1650 from pbiering/no-cache-invalidation-on-upgrade
Browse files Browse the repository at this point in the history
No cache invalidation on upgrade
  • Loading branch information
pbiering authored Dec 14, 2024
2 parents 778f56c + 9787f87 commit be5eab8
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
* Add: option [storage] use_cache_subfolder_for_synctoken for storing 'sync-token' cache outside collection-root
* Add: option [storage] folder_umask for configuration of umask (overwrite system-default)
* Fix: also remove 'item' from cache on delete
* Improve: avoid automatically invalid cache on upgrade in case no change on cache structure
* Improve: log important module versions on startup

## 3.3.1

Expand Down
4 changes: 2 additions & 2 deletions radicale/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright © 2008 Nicolas Kandel
# Copyright © 2008 Pascal Halter
# Copyright © 2008-2017 Guillaume Ayoub
# Copyright © 2017-2019 Unrud <[email protected]>
# Copyright © 2017-2023 Unrud <[email protected]>
# Copyright © 2024-2024 Peter Bieringer <[email protected]>
#
# This library is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -301,7 +301,7 @@ def serve(configuration: config.Configuration,
"""

logger.info("Starting Radicale")
logger.info("Starting Radicale (%s)", utils.packages_version())
# Copy configuration before modifying
configuration = configuration.copy()
configuration.update({"server": {"_internal_server": "True"}}, "server",
Expand Down
11 changes: 7 additions & 4 deletions radicale/storage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Copyright © 2014 Jean-Marc Martins
# Copyright © 2012-2017 Guillaume Ayoub
# Copyright © 2017-2022 Unrud <[email protected]>
# Copyright © 2024-2024 Peter Bieringer <[email protected]>
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,17 +36,19 @@
from radicale import item as radicale_item
from radicale import types, utils
from radicale.item import filter as radicale_filter
from radicale.log import logger

INTERNAL_TYPES: Sequence[str] = ("multifilesystem", "multifilesystem_nolock",)

CACHE_DEPS: Sequence[str] = ("radicale", "vobject")
CACHE_VERSION: bytes = "".join(
"%s=%s;" % (pkg, utils.package_version(pkg))
for pkg in CACHE_DEPS).encode()
# NOTE: change only if cache structure is modified to avoid cache invalidation on update
CACHE_VERSION_RADICALE = "3.3.1"

CACHE_VERSION: bytes = ("%s=%s;%s=%s;" % ("radicale", CACHE_VERSION_RADICALE, "vobject", utils.package_version("vobject"))).encode()


def load(configuration: "config.Configuration") -> "BaseStorage":
"""Load the storage module chosen in configuration."""
logger.debug("storage cache version: %r", str(CACHE_VERSION))
return utils.load_plugin(INTERNAL_TYPES, "storage", "Storage", BaseStorage,
configuration)

Expand Down
9 changes: 9 additions & 0 deletions radicale/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

_T_co = TypeVar("_T_co", covariant=True)

RADICALE_MODULES: Sequence[str] = ("radicale", "vobject", "passlib", "defusedxml")


def load_plugin(internal_types: Sequence[str], module_name: str,
class_name: str, base_class: Type[_T_co],
Expand All @@ -51,6 +53,13 @@ def package_version(name):
return metadata.version(name)


def packages_version():
versions = []
for pkg in RADICALE_MODULES:
versions.append("%s=%s" % (pkg, package_version(pkg)))
return " ".join(versions)


def ssl_context_options_by_protocol(protocol: str, ssl_context_options):
logger.debug("SSL protocol string: '%s' and current SSL context options: '0x%x'", protocol, ssl_context_options)
# disable any protocol by default
Expand Down

0 comments on commit be5eab8

Please sign in to comment.