Closed isZumpo closed 2 months ago
The 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.
File Path | Change Summary |
---|---|
internal/analysis/... |
Added functions for initializing and running clip cleanup monitoring. |
internal/conf/config.go |
Updated Settings struct to include retention parameters. |
internal/datastore/... |
Enhanced interface with methods for clip removal and added tests for new functionality. |
🐇✨ In the burrow of the code, deep and wide, A cleanup crew now does reside. Old clips fade, new space is found, In digital fields, where bytes abound. Hop, skip, a jump in the code's weave, A tidy den, as we perceive. 🌟 🐇✨
lint failure (5)
internal/analysis/realtime.go: [failure] 179-179: Error return value of `dataStore.DeleteNoteClipPath` is not checked (errcheck) --- internal/datastore/interfaces_test.go: [failure] 38-38: Error return value of `dataStore.Save` is not checked (errcheck) --- internal/datastore/interfaces_test.go: [failure] 43-43: Error return value of `dataStore.Save` is not checked (errcheck) --- internal/datastore/interfaces_test.go: [failure] 48-48: Error return value of `dataStore.Save` is not checked (errcheck)
internal/datastore/interfaces_test.go (3)
`11-25`: Setup and teardown of the test database are handled correctly. --- `43-43`: Similar to the previous comment, the error return value of `dataStore.Save` is not checked here as well. --- `48-48`: Again, ensure to check the error return value from `dataStore.Save`.
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