bluerobotics / cockpit

An intuitive and customizable cross-platform ground control station for remote vehicles of all types.
https://docs.bluerobotics.com/ardusub-zola/software/control-station/Cockpit-1.0/overview/
Other
46 stars 19 forks source link

sensors-logging: Find log by day prioritizing those from the last day #919

Closed rafaellehmkuhl closed 2 months ago

rafaellehmkuhl commented 3 months ago

Telemetry logs are taking a lot of time to be processed, and looking more into it, I realized it is because we are accessing each log file individually and checking if it matches our criteria.

This patch fixes it with a quick and dirty solution: iterating first over the logs from the day of the video and the day before, and only them on the rest of the logs (which would be the case only for videos being recorded for more than 24 horus...).

The best solution would be to index the DB by timestamp, sort it and check the logs starting from the most recent one, with a proper cursor, but it is a more complex solution that I need to study more about, while the one here solves the problem already.

Fix #908