Open
Conversation
Before "revert separate caching folder implementation" #1461
Cast cache_max_age to time_t to avoid implicit signedness conversion between uint64_t and time_t. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add explicit static_cast<time_t>() for cache_max_age to fix -Wsign-conversion warning on Windows with clang-cl. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jpnurmi
pushed a commit
that referenced
this pull request
Jan 26, 2026
|
jpnurmi
pushed a commit
that referenced
this pull request
Jan 26, 2026
jpnurmi
pushed a commit
that referenced
this pull request
Jan 26, 2026
jpnurmi
pushed a commit
that referenced
this pull request
Jan 26, 2026
For consistency with time-related operations throughout the codebase. This adds a time.h dependency to the public header, but it's a lightweight standard C header available since C89. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Subtract file size from accumulated_size when a file is pruned (by age or size). Previously, pruned files' sizes were still counted, causing subsequent valid files to be incorrectly pruned when both cache_max_age and cache_max_size were set. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move size accumulation into else branch so age-pruned files don't count toward size limit. Remove the size subtraction on prune which caused bin-packing behavior (keeping older smaller files while removing newer larger ones). Add test for size-based pruning order. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jpnurmi
pushed a commit
that referenced
this pull request
Feb 4, 2026
- Check CreateFileW return value before calling SetFileTime/CloseHandle - Change TEST_CHECK to TEST_ASSERT since mtime setup is a precondition Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
cache_dir is NULL when cache_keep is false, and sentry__path_free handles NULL safely. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jpnurmi
pushed a commit
that referenced
this pull request
Feb 4, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
Crashpad's AgePruneCondition and DatabaseSizePruneCondition only accept days and KB respectively, causing precision loss for sub-day ages and sub-KB sizes. Replace them with MaxAgePruneCondition (seconds) and MaxSizePruneCondition (bytes) that handle zero as "no limit" internally. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
jpnurmi
pushed a commit
that referenced
this pull request
Feb 4, 2026
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Re-order cache_max_items before max_size/max_age for visibility as the most relevant default limit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
Adds offline caching support for the
inprocandbreakpadbackends, allowing envelopes to be persisted locally for debugging and offline scenarios. When enabled, envelopes are retained in acache/subdirectory within the database path, regardless of whether the send succeeds or fails.On startup, the cache is pruned based on the configured limits (max items, age, size), removing entries from oldest to newest until constraints are satisfied. The pruning algorithm is based on Crashpad's
prune_crash_reports.cc.API
New options:
sentry_options_set_cache_keep(opts, int enabled)- Enables/disables offline cachingsentry_options_set_cache_max_items(opts, size_t items)- Maximum number of cache entries (default: 30)sentry_options_set_cache_max_size(opts, size_t bytes)- Maximum cache directory size (no default max size)sentry_options_set_cache_max_age(opts, time_t seconds)- Maximum age for cache entries (no default max age)Usage
Comparison
cache_keep(default: off)cache_max_items(30)maxCacheItems(30)maxCacheItems(30)cache_max_size(0)cache_max_age(0)Limitations
Related
Test Plan
test_cache.c)test_integration_cache.py)Co-authored-by: @JoshuaMoelans
Closes: #1461