Skip to content

AxiosError: timeout of 30000ms exceeded while trying to see activity for one month #629

Description

@wojnilowicz

While trying to view my activity for 2026-06 at http://localhost:5600/#/activity/your_hostname_here/month/2026-06-01/view/summary
I get
AxiosError: timeout of 30000ms exceeded. See dev console (F12) and/or server logs for more info. and my views hang with "Loading..." in them. Nothing particularly interesting after pressing F12.

  1. My ~/.local/share/activitywatch/aw-server-rust/sqlite.db is 168 MB big and contains data since 2024-01.
  2. After Performance improvements #615 it's not better.
  3. I'm on b199671.
  4. This is a low end machine.
  5. aw-server process gets from 20 MB in RAM to something over 100 MB when trying to display the report. It looks like it's trying to load whole database instead of only the time period that I'm interested in.

This is kind of a wish than a bug: Could ActivityWatch be made so that it doesn't start to time out on reports when there is more data in the database? I remember watching 1 month time periods without problem earlier on.

Activity

  1. TimeToBuildBob commented on Aug 25, 2026

    @TimeToBuildBob
    Contributor

    Opened #657 with the fix.

    Root cause: in was evaluating every event against every regex rule individually — ~1M evaluations for a typical month (50k+ events × 20 rules). Most events share identical app/title data, so the same matches were recomputed thousands of times.

    Fix: added a -based cache inside keyed on the serialized event data. Only the first occurrence of each distinct data fingerprint hits the regex engine; subsequent identical events reuse the cached category. For 50k events with ~200 distinct app/title pairs this reduces regex work from 1M to ~4k evaluations (~250×).

  2. added a commit that references this issue on Aug 25, 2026
    7429039
  3. wojnilowicz commented on Aug 29, 2026

    @wojnilowicz
    ContributorAuthor

    Thanks. This fixes my error. I'm afraid that these optimizations to regex might not hold long enough, once I'll have even larger database.
    If I understood the fix correctly, still every event (instead of only events in the selected time period) in my database goes through regex evaluation.

  4. TimeToBuildBob commented on Aug 29, 2026

    @TimeToBuildBob
    Contributor

    That's not how the query path works — regex never runs over the whole database.

    query_bucket() always fetches only the selected time range. The month view sets TIMEINTERVAL to that month, and the datastore query is:

    SELECT id, starttime, endtime, data
    FROM events
    WHERE bucketrow = ?
      AND endtime >= <month start>
      AND starttime <= <month end>

    (aw-datastore/src/datastore.rs get_events_inner, called from aw-query/src/functions.rs query_bucket.)

    categorize() then runs only on those events. Growing the historical database does not add regex work to a month query. What would make a month view slower is more events in that month, more distinct app/title pairs, or more category rules.

    The cache makes categorization scale with distinct app/title combinations in the period, not with raw event count or total DB size. The RAM bump you saw (20 MB → ~100 MB) is loading that month's events into memory, not the 168 MB sqlite file.

    If a month view starts timing out again because the period itself gets denser, that's a useful report — but total DB size alone shouldn't bring it back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions