From my understanding of the code, and documentation, every time the localhost page reloads, the top activities in all categories are recalculated from the beginning. If you have a lot of events, that can lead to a timeout( ActivityWatch/activitywatch#217). I think performance could be improved by creating a new table in the database where you store the summarized events. The columns would be:
Key(URLs, domains, app_events, title_events), Value(i.e github.com, localhost:5600), Duration, and Day.
Thus every time the page reloads, it only summarizes the new events, then adds the new domains/urls/etc and updates the existing ones. Then you just retrieve the results. This has two advantages:
- Decreases the time to calculate the summary for the day, as you perform a lot fewer calculations.
- Makes analyzing statistics for a week, month, year a lot faster since the table will have a summary of the events for every day. Therefore, you just retrieve the right amount of days and perform analysis on them.
@ErikBjare , @johan-bjareholt, what do you guys think? Are there any current initiatives like this already in the works? If not, I can start working on it
From my understanding of the code, and documentation, every time the localhost page reloads, the top activities in all categories are recalculated from the beginning. If you have a lot of events, that can lead to a timeout( ActivityWatch/activitywatch#217). I think performance could be improved by creating a new table in the database where you store the summarized events. The columns would be:
Key(URLs, domains, app_events, title_events), Value(i.e github.com, localhost:5600), Duration, and Day.
Thus every time the page reloads, it only summarizes the new events, then adds the new domains/urls/etc and updates the existing ones. Then you just retrieve the results. This has two advantages:
@ErikBjare , @johan-bjareholt, what do you guys think? Are there any current initiatives like this already in the works? If not, I can start working on it