-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
feat: Add initial retention policy #121
Conversation
WalkthroughThe recent update introduces a system for monitoring and automatically deleting clips based on a retention policy. This involves initializing the monitoring process, determining which clips qualify for deletion, and executing the removal process. Configuration settings have been updated to include parameters that define the retention criteria. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (4)
Additional Context UsedGitHub Check Runs (1)
Additional comments not posted (3)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
// No Amazing bird should be removed since there is only one | ||
// While there are two Wonderful birds, only one of them are old enough, but too few to be removed | ||
// While there are two Magnificent birds, only one of them have a clip, meaning that the remaining one should be kept | ||
dataStore.Save(&Note{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error return value of dataStore.Save
is not checked. Consider handling this to avoid uncaught errors during tests.
- dataStore.Save(&Note{...}, []Results{})
+ if err := dataStore.Save(&Note{...}, []Results{}); err != nil {
+ t.Fatalf("Failed to save note: %v", err)
+ }
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
dataStore.Save(&Note{ | |
if err := dataStore.Save(&Note{ |
Thank you, merged. |
That went way quicker than expected. Suppose that we will have to work out those questions as we go instead. |
As mentioned, I wanted to give the simple retention policy a try. Anything is better than nothing as my raspberry keeps running out of space otherwise. I am still trying out this change locally and might make some more changes to it. However, I thought it could still be a good idea to open up this pull request to get some feedback on the idea itself and the code.
The simple retention policy works by every minute, querying the database for clips older than minEvictionHours, for these clips, it will then remove those for species that have more than minClipsPerSpecies. Always removing the oldest clips first.
I am a bit uncertain of where to place all the logic. Right now I jammed it into the realtime.go and interface.go, but there might be better places to put it? In addition, it has to be decided if this is a feature which should be enabled by default or not. In addition, the spectrogram images are currently saved to the clips folder too, I wonder if it might be better to move them to some other cached directory?
Summary by CodeRabbit