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

Keep event history in circular buffer #316

Merged
merged 1 commit into from
Apr 26, 2024
Merged

Keep event history in circular buffer #316

merged 1 commit into from
Apr 26, 2024

Conversation

gammazero
Copy link
Owner

Event history stored in circular buffer

Description, Motivation and Context

Storing event history in a circular buffer avoids memory allocation after the storage limit is reached.

  • Minor fixes to storage history logic, such as checking result of type assertion.
  • Order message type switch to check for most common messages first
  • Minor code improvements

What is the current behavior?

When event history limit is reached, the beginning of the history entries slice is ignored: entries = entries[1:]

What is the new behavior?

A circular buffer is used instead to store event history.

What kind of change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • Overall test coverage is not decreased.
  • All new and existing tests passed.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Storing event history in a circular buffer avoids memory allocation after the storage limit is reached.

- Minor fixes to storage history logic
- Order message type switch to check for most common messages first
- Minor code improvements
@gammazero gammazero merged commit 5cfa511 into v3 Apr 26, 2024
6 checks passed
@gammazero gammazero deleted the event-hist-buf branch April 26, 2024 04:09
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.

1 participant