Add configuration option to control maximum number of persisted events/sessions #980
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.
Goal
The bugsnag-android SDK persists events & sessions to disk if it is unable to deliver them to the API due to network failure. This provides a configuration option to control how many payloads should be stored on disk for both events and sessions.
Changeset
maxPersistedEvents
andmaxPersistedSessions
toConfiguration
with a default value of 32MAX_PERSISTED_EVENTS
andMAX_PERSISTED_SESSIONS
for reading configuration options from the manifestEventStore
andSessionStore
so that they respect the configuration optionsdiscardOldestFileIfNeeded()
, where in the unlikely scenario that >32 payloads were persisted on disk, the function would delete all the payloads if another payload needed persistingTesting
Added integration tests which verify the event/session store classes only persist up to the configured limit, and that this limit can be changed. Unit tests verify that the max persisted events/sessions configuration options are validated as necessary.