Commit Graph
1 Commits
  • fix(node): ignore a node's stats for clients detached from the inbound
    Invariant: a node snapshot may move a master client's traffic state only
    for emails the reporting inbound's settings still list.
    
    A master detach calls the node's /detach endpoint, which keeps the stat
    row (keepTraffic), and the node's GetInbounds preloads ClientStats by
    inbound_id alone, so the node goes on reporting the detached email under
    that inbound. setRemoteTrafficLocked merged every reported entry: it
    copied the node's stale total onto the master's per-email row, after
    which the matching limits made the node's enable=false look genuine and
    latched the client disabled on the master. A master quota edit only
    reaches inbounds the client is attached to, so the next sync (every 5s)
    wrote the stale quota back.
    
    The same unchecked loop also created a fresh client_traffics row for a
    reported email the master no longer had once its tombstone expired.
    
    Snapshot entries are now gated on the inbound's settings.clients. When
    the settings cannot be parsed, membership is unknown and every entry is
    merged as before.
    
    Closes #6724