fix(#5619): reload config cache on profile switch

This commit is contained in:
Rod Boev committed 2026-07-05 16:22:35 -04:00
1 parent 9b18ea9f99
commit 4c3a4e011e
3 files changed
+89 -12

No files matched your search

+6 -4
View File
@@ -450,8 +450,9 @@ def reload_config_if_stale() -> None:
current_mtime = config_path.stat().st_mtime
except OSError:
current_mtime = 0.0
cache_stale = current_mtime != _cfg_mtime or _cfg_path != config_path
if not _cfg_cache or (cache_stale and not _cfg_has_in_memory_overrides()):
path_changed = _cfg_path != config_path
mtime_stale = current_mtime != _cfg_mtime
if not _cfg_cache or path_changed or (mtime_stale and not _cfg_has_in_memory_overrides()):
_refresh_config_cache(config_path)
@@ -462,8 +463,9 @@ def get_config() -> dict:
current_mtime = config_path.stat().st_mtime
except OSError:
current_mtime = 0.0
cache_stale = current_mtime != _cfg_mtime or _cfg_path != config_path
if not _cfg_cache or (cache_stale and not _cfg_has_in_memory_overrides()):
path_changed = _cfg_path != config_path
mtime_stale = current_mtime != _cfg_mtime
if not _cfg_cache or path_changed or (mtime_stale and not _cfg_has_in_memory_overrides()):
reload_config_if_stale()
# When a test (or runtime caller) has rebound ``cfg`` to a different dict
# via monkeypatch.setattr(config, "cfg", ...), return that override rather