Skip to content

Commit 766fe82

Browse files
authored
Use separate cache pathes for different python/CLI versions (#778)
* Use separate cache pathes for different python/CLI versions * fix
1 parent 6be9be3 commit 766fe82

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mapillary_tools/uploader.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
types,
3737
upload_api_v4,
3838
utils,
39+
VERSION,
3940
)
4041
from .camm import camm_builder, camm_parser
4142
from .gpmf import gpmf_parser
@@ -799,8 +800,14 @@ def _maybe_create_persistent_cache_instance(
799800
LOG.debug("Dry-run mode enabled, skipping caching upload file handles")
800801
return None
801802

803+
# Different python/CLI versions use different cache (dbm) formats.
804+
# Separate them to avoid conflicts
805+
py_version_parts = [str(part) for part in sys.version_info[:3]]
806+
version = f"py_{'_'.join(py_version_parts)}_{VERSION}"
807+
802808
cache_path_dir = (
803809
Path(constants.UPLOAD_CACHE_DIR)
810+
.joinpath(version)
804811
.joinpath(api_v4.MAPILLARY_CLIENT_TOKEN.replace("|", "_"))
805812
.joinpath(
806813
user_items.get("MAPSettingsUserKey", user_items["user_upload_token"])
@@ -812,6 +819,7 @@ def _maybe_create_persistent_cache_instance(
812819
# Sanitize sensitive segments for logging
813820
sanitized_cache_path = (
814821
Path(constants.UPLOAD_CACHE_DIR)
822+
.joinpath(version)
815823
.joinpath("***")
816824
.joinpath("***")
817825
.joinpath("cached_file_handles")

0 commit comments

Comments
 (0)