Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration option to control maximum number of persisted events/sessions #980

Conversation

fractalwrench
Copy link
Contributor

@fractalwrench fractalwrench commented Nov 3, 2020

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

  • Added maxPersistedEvents and maxPersistedSessions to Configuration with a default value of 32
  • Added MAX_PERSISTED_EVENTS and MAX_PERSISTED_SESSIONS for reading configuration options from the manifest
  • Updated EventStore and SessionStore so that they respect the configuration options
  • Fixed a bug in discardOldestFileIfNeeded(), where in the unlikely scenario that >32 payloads were persisted on disk, the function would delete all the payloads if another payload needed persisting

Testing

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.

@bugsnagbot
Copy link
Collaborator

Android notifier sizes

Format Size impact of Bugsnag (kB) Size impact of Bugsnag when Minified (kB)
APK 1441.64 1361.29
arm64_v8a 369.25 287.33
armeabi 348.77 266.85
armeabi_v7a 332.39 250.47
x86 410.2 328.28
x86_64 389.73 307.81

Generated by 🚫 Danger

@fractalwrench fractalwrench marked this pull request as ready for review November 3, 2020 17:16
@tomlongridge
Copy link
Contributor

Do we definitely want to allow the value 0 for this configuration? Does that not effectively break the functionality as nothing would be delivered?

@fractalwrench
Copy link
Contributor Author

Do we definitely want to allow the value 0 for this configuration? Does that not effectively break the functionality as nothing would be delivered?

I felt this was a reasonable, if a bit of an unusual, use-case. It would still allow users to send handled errors and sessions if they didn't want to persist them on disk if delivery was not possible. This is effectively what we do for Internal Error reporting already.

@fractalwrench fractalwrench merged commit 5ec7c21 into integration/road-958-multi-process Nov 5, 2020
@fractalwrench fractalwrench deleted the PLAT-5188/max-persisted-events branch November 5, 2020 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants