Repository navigation
stats: add cache_enabled, only report cache_* keys if a cache is configured - #236
Open
MuhammadBilal64 wants to merge 1 commit into
Open
MuhammadBilal64 wants to merge 1 commit into
MuhammadBilal64 wants to merge 1 commit into
Conversation
… is configured Store.stats always contained the cache_* keys, so 'no cache configured' and 'cache configured and working' were indistinguishable (cache_disabled was False in both cases). - add cache_enabled: True only if a cache backend is configured and was not disabled at runtime - only include the other cache_* keys if a cache backend is configured - cache_disabled keeps its meaning: True if the cache backend failed to open at runtime - tests for no cache / working cache / cache failing to open, adjust test_stats - docs: describe the new stats keys Fixes borgbackup#199
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #199
Store.stats reported cache_disabled: False and all-zero cache counters
for stores without any cache backend, which reads as "cache present and enabled".
Changes:
cache_enabled(cache_backend is not None and not _cache_disabled).so generic renderers drop the whole cache block for uncached stores.
cache_disabledis unchanged: True if the cache backend failed to open.test_stats adjusted.
Note: consumers that render the stats dict generically (e.g. borg) need a
matching update for the new key and for the cache_* keys now being optional.