Skip to content

usage history: an update during start-up can be missed (read before subscribe) #60

Closed

Description

@scuttletoby

Found in review of #52 (settings lens, round 2): #52 (comment). Left in fix round 2; there is now a code comment at the spot.

What: at start-up, UsageReadingsHistory.ts (around lines 675-677) reads the current state first and only then subscribes to updates. An update that arrives between the read and the subscription is never recorded.

Effect: one usage reading can go missing at start-up. The next refresh records it again, so the pacer sees the account as unknown for a while; it is never treated as free.

Fix: subscribe first, then read (and drop duplicates), with a test that sends an update between the two steps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions