element-hq / element-hq/synapse

`last_active_ago` is updated on sync when it shouldn't be

Open
#12,424 0 comments 0 reactions 0 assignees View on GitHub
A-Presence A-Sync S-Tolerable T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#12424](https://github.com/matrix-org/synapse/issues/12424).

---

### Description

The `last_active_ts` is updated for a user when they perform a regular sync request where their previous presence is 'online'. It looks like synapse intends to only update this when a sync is performed with `set_presence = online` and the previous presence state is online, and the spec says it should only be updated on a proactive event from the user.

This is because `set_state` is called in order to set the new presence state and this method always updated last_active_ago.

Found while working on https://github.com/matrix-org/synapse/pull/12213 but I think this will need another inter-process API added to fix.

### Steps to reproduce

- Have two users, leave one syncing.
- On the other user, perform a sync request
- Notice on the first sync stream that the last_active_ago value for the other user reflects the the sync you just did.

### Version information

- **Homeserver**:

If not matrix.org:

- **Version**:

- **Install method**:

- **Platform**:

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.