ActivityWatch / activitywatch

The best free and open-source automated time tracker. Cross-platform, extensible, privacy-focused.
https://activitywatch.net/
Mozilla Public License 2.0
11.96k stars 545 forks source link

Query Caching #991

Open ErikBjare opened 10 months ago

ErikBjare commented 10 months ago

I've thought about adding proper caching of queries to make browsing historical data much snappier, after the first open.

The goal is to:

As a first step, I've considered adding query caching to aw-client-js such that queries are:

Should be a simple improvement, that could massively improve responsiveness and thus general UX of web UI, especially when browsing historical data.

I'm not sure what kind of cache expiry to add, but I might figure that out as I get going.

PRs:

ErikBjare commented 10 months ago

Now added basic caching, which gets invalidated on page reload. Significantly speeds up browsing around different dates.

Also found a bunch of requests that weren't needed, reducing the total number of requests significantly.

We can consider persisting the cache with some expiry mechanism in the future, to make it reload past dates superfast, even after page reloads.