This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Combine logic about not overriding BUSY presence. #16170
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Move duplicated logic from main & worker user_syncing methods to set_state, which is called direclty on main and over replication for workers. The new logic is driven by a is_sync flag, which avoids overriding the "busy" presence state.
Building on the previous commit, last_user_sync_ts can now be set based on the is_sync flag.
VALID_PRESENCE only contains the busy presence if it is enabled, thus presence can only be equal to "busy" if it is already enabled.
See inline comments, but the user_syncing method already calls set_state(...) to update the presence state, we don't need custom logic for the offline -> online transition.
This was referenced Aug 23, 2023
MatMaul
reviewed
Aug 28, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems globally sane, but I should say that some part of the logic is still a bit blurry to me, especially the part around multi-devices syncs :)
MatMaul
approved these changes
Aug 28, 2023
hughns
pushed a commit
that referenced
this pull request
Sep 4, 2023
Simplify some of the presence code by reducing duplicated code between worker & non-worker modes. The main change is to push some of the logic from `user_syncing` into `set_state`. This is done by passing whether the user is setting the presence via a `/sync` with a new `is_sync` flag to `set_state`. If this is `true` some additional logic is performed: * Don't override `busy` presence. * Update the `last_user_sync_ts`. * Never update the status message.
DMRobertson
pushed a commit
that referenced
this pull request
Sep 5, 2023
- Add configuration setting for CAS protocol version. Contributed by Aurélien Grimpard. ([\#15816](#15816)) - Suppress notifications from message edits per [MSC3958](matrix-org/matrix-spec-proposals#3958). ([\#16113](#16113)) - Return a `Retry-After` with `M_LIMIT_EXCEEDED` error responses. ([\#16136](#16136)) - Add `last_seen_ts` to the [admin users API](https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html). ([\#16218](#16218)) - Improve resource usage when sending data to a large number of remote hosts that are marked as "down". ([\#16223](#16223)) - Fix IPv6-related bugs on SMTP settings, adding groundwork to fix similar issues. Contributed by @evilham and @telmich (ungleich.ch). ([\#16155](#16155)) - Fix a spec compliance issue where requests to the `/publicRooms` federation API would specify `include_all_networks` as a string. ([\#16185](#16185)) - Fix inaccurate error message while attempting to ban or unban a user with the same or higher PL by spliting the conditional statements. Contributed by @leviosacz. ([\#16205](#16205)) - Fix a rare bug that broke looping calls, which could lead to e.g. linearly increasing memory usage. Introduced in v1.90.0. ([\#16210](#16210)) - Fix a long-standing bug where uploading images would fail if we could not generate thumbnails for them. ([\#16211](#16211)) - Fix a long-standing bug where we did not correctly back off from servers that had "gone" if they returned 4xx series error codes. ([\#16221](#16221)) - Update links to the [matrix.org blog](https://matrix.org/blog/). ([\#16008](#16008)) - Document which [admin APIs](https://matrix-org.github.io/synapse/latest/usage/administration/admin_api/index.html) are disabled when experimental [MSC3861](matrix-org/matrix-spec-proposals#3861) support is enabled. ([\#16168](#16168)) - Document [`exclude_rooms_from_sync`](https://matrix-org.github.io/synapse/v1.92/usage/configuration/config_documentation.html#exclude_rooms_from_sync) configuration option. ([\#16178](#16178)) - Prepare unit tests for Python 3.12. ([\#16099](#16099)) - Fix nightly CI jobs. ([\#16121](#16121), [\#16213](#16213)) - Describe which rate limiter was hit in logs. ([\#16135](#16135)) - Simplify presence code when using workers. ([\#16170](#16170)) - Track per-device information in the presence code. ([\#16171](#16171), [\#16172](#16172)) - Stop using the `event_txn_id` table. ([\#16175](#16175)) - Use `AsyncMock` instead of custom code. ([\#16179](#16179), [\#16180](#16180)) - Improve error reporting of invalid data passed to `/_matrix/key/v2/query`. ([\#16183](#16183)) - Task scheduler: add replication notify for new task to launch ASAP. ([\#16184](#16184)) - Improve type hints. ([\#16186](#16186), [\#16188](#16188), [\#16201](#16201)) - Bump black version to 23.7.0. ([\#16187](#16187)) - Log the details of background update failures. ([\#16212](#16212)) - Cache device resync requests over replication. ([\#16241](#16241)) * Bump anyhow from 1.0.72 to 1.0.75. ([\#16141](#16141)) * Bump furo from 2023.7.26 to 2023.8.19. ([\#16238](#16238)) * Bump phonenumbers from 8.13.18 to 8.13.19. ([\#16237](#16237)) * Bump psycopg2 from 2.9.6 to 2.9.7. ([\#16196](#16196)) * Bump regex from 1.9.3 to 1.9.4. ([\#16195](#16195)) * Bump ruff from 0.0.277 to 0.0.286. ([\#16198](#16198)) * Bump sentry-sdk from 1.29.2 to 1.30.0. ([\#16236](#16236)) * Bump serde from 1.0.184 to 1.0.188. ([\#16194](#16194)) * Bump serde_json from 1.0.104 to 1.0.105. ([\#16140](#16140)) * Bump types-psycopg2 from 2.9.21.10 to 2.9.21.11. ([\#16200](#16200)) * Bump types-pyyaml from 6.0.12.10 to 6.0.12.11. ([\#16199](#16199))
yingziwu
added a commit
to yingziwu/synapse
that referenced
this pull request
Oct 3, 2023
No significant changes since 1.93.0rc1. The following issues are fixed in 1.93.0 (and RCs). - [GHSA-4f74-84v3-j9q5](GHSA-4f74-84v3-j9q5) / [CVE-2023-41335](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-41335) — Low Severity Temporary storage of plaintext passwords during password changes. - [GHSA-7565-cq32-vx2x](GHSA-7565-cq32-vx2x) / [CVE-2023-42453](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-42453) — Low Severity Improper validation of receipts allows forged read receipts. See the advisories for more details. If you have any questions, email security@matrix.org. - Add automatic purge after all users have forgotten a room. ([\matrix-org#15488](matrix-org#15488)) - Restore room purge/shutdown after a Synapse restart. ([\matrix-org#15488](matrix-org#15488)) - Support resolving homeservers using `matrix-fed` DNS SRV records from [MSC4040](matrix-org/matrix-spec-proposals#4040). ([\matrix-org#16137](matrix-org#16137)) - Add the ability to use `G` (GiB) and `T` (TiB) suffixes in configuration options that refer to numbers of bytes. ([\matrix-org#16219](matrix-org#16219)) - Add span information to requests sent to appservices. Contributed by MTRNord. ([\matrix-org#16227](matrix-org#16227)) - Add the ability to enable/disable registrations when using CAS. Contributed by Aurélien Grimpard. ([\matrix-org#16262](matrix-org#16262)) - Allow the `/notifications` endpoint to be routed to workers. ([\matrix-org#16265](matrix-org#16265)) - Enable users to easily unsubscribe to notifications emails via the `List-Unsubscribe` header. ([\matrix-org#16274](matrix-org#16274)) - Report whether a user is `locked` in the [List Accounts admin API](https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#list-accounts), and exclude locked users by default. ([\matrix-org#16328](matrix-org#16328)) - Fix a long-standing bug where multi-device accounts could cause high load due to presence. ([\matrix-org#16066](matrix-org#16066), [\matrix-org#16170](matrix-org#16170), [\matrix-org#16171](matrix-org#16171), [\matrix-org#16172](matrix-org#16172), [\matrix-org#16174](matrix-org#16174)) - Fix a long-standing bug where appservices using [MSC2409](matrix-org/matrix-spec-proposals#2409) to receive `to_device` messages would only get messages for one user. ([\matrix-org#16251](matrix-org#16251)) - Fix bug when using workers where Synapse could end up re-requesting the same remote device repeatedly. ([\matrix-org#16252](matrix-org#16252)) - Fix long-standing bug where we kept re-requesting a remote server's key repeatedly, potentially causing delays in receiving events over federation. ([\matrix-org#16257](matrix-org#16257)) - Avoid temporary storage of sensitive information. ([\matrix-org#16272](matrix-org#16272)) - Fix bug introduced in Synapse 1.49.0 when using dehydrated devices ([MSC2697](matrix-org/matrix-spec-proposals#2697)) and refresh tokens. Contributed by Hanadi. ([\matrix-org#16288](matrix-org#16288)) - Fix a long-standing bug where invalid receipts would be accepted. ([\matrix-org#16327](matrix-org#16327)) - Use standard name for UTF-8 charset in emails. ([\matrix-org#16329](matrix-org#16329)) - Don't try refetching device lists for users on remote hosts that are marked as "down". ([\matrix-org#16298](matrix-org#16298)) - Fix typos in the documentation. ([\matrix-org#16282](matrix-org#16282)) - Link to the Alpine Linux community package for Synapse. ([\matrix-org#16304](matrix-org#16304)) - Use string for `federation_client_minimum_tls_version` documentation examples. Contributed by @jcgruenhage. ([\matrix-org#16353](matrix-org#16353)) - Allow modules to delete rooms. ([\matrix-org#15997](matrix-org#15997)) - Add GCC and GNU Make to the Nix flake development environment so that `ruff` can be compiled. ([\matrix-org#16090](matrix-org#16090), [\matrix-org#16263](matrix-org#16263)) - Fix type checking when using the new version of Twisted. ([\matrix-org#16235](matrix-org#16235)) - Delete device messages asynchronously and in staged batches using the task scheduler. ([\matrix-org#16240](matrix-org#16240), [\matrix-org#16311](matrix-org#16311), [\matrix-org#16312](matrix-org#16312), [\matrix-org#16313](matrix-org#16313)) - Bump minimum supported Rust version to 1.61.0. ([\matrix-org#16248](matrix-org#16248)) - Update rust to version 1.71.1 in the nix development environment. ([\matrix-org#16260](matrix-org#16260)) - Simplify server key storage. ([\matrix-org#16261](matrix-org#16261)) - Reduce CPU overhead of change password endpoint. ([\matrix-org#16264](matrix-org#16264)) - Stop purging from tables slated for removal. ([\matrix-org#16273](matrix-org#16273)) - Improve type hints. ([\matrix-org#16276](matrix-org#16276), [\matrix-org#16301](matrix-org#16301), [\matrix-org#16325](matrix-org#16325), [\matrix-org#16326](matrix-org#16326)) - Raise `setuptools_rust` version cap to 1.7.0. ([\matrix-org#16277](matrix-org#16277)) - Fix using the new task scheduler causing lots of CPU to be used. ([\matrix-org#16278](matrix-org#16278)) - Upgrade CI run of Python 3.12 from rc1 to rc2. ([\matrix-org#16280](matrix-org#16280)) - Include values in SQL debug when using `execute_values` with Postgres. ([\matrix-org#16281](matrix-org#16281)) - Enable additional linting checks. ([\matrix-org#16283](matrix-org#16283)) - Refactor `receipts_graph` Postgres transactions to stop error messages. ([\matrix-org#16299](matrix-org#16299)) - Small improvements to logging in replication code. ([\matrix-org#16309](matrix-org#16309)) - Remove a reference cycle in background processes. ([\matrix-org#16314](matrix-org#16314)) - Only use literal strings for background process names. ([\matrix-org#16315](matrix-org#16315)) - Refactor `get_user_by_id`. ([\matrix-org#16316](matrix-org#16316)) - Speed up task to delete to-device messages. ([\matrix-org#16318](matrix-org#16318)) - Avoid patching code in tests. ([\matrix-org#16349](matrix-org#16349)) - Test against PostgreSQL 16. ([\matrix-org#16351](matrix-org#16351)) * Bump mypy from 1.4.1 to 1.5.1. ([\matrix-org#16300](matrix-org#16300)) * Bump black from 23.7.0 to 23.9.1. ([\matrix-org#16295](matrix-org#16295)) * Bump docker/build-push-action from 4 to 5. ([\matrix-org#16336](matrix-org#16336)) * Bump docker/login-action from 2 to 3. ([\matrix-org#16339](matrix-org#16339)) * Bump docker/metadata-action from 4 to 5. ([\matrix-org#16337](matrix-org#16337)) * Bump docker/setup-qemu-action from 2 to 3. ([\matrix-org#16338](matrix-org#16338)) * Bump furo from 2023.8.19 to 2023.9.10. ([\matrix-org#16340](matrix-org#16340)) * Bump gitpython from 3.1.32 to 3.1.35. ([\matrix-org#16267](matrix-org#16267), [\matrix-org#16279](matrix-org#16279)) * Bump mypy-zope from 1.0.0 to 1.0.1. ([\matrix-org#16291](matrix-org#16291)) * Bump pillow from 10.0.0 to 10.0.1. ([\matrix-org#16344](matrix-org#16344)) * Bump regex from 1.9.4 to 1.9.5. ([\matrix-org#16233](matrix-org#16233)) * Bump ruff from 0.0.286 to 0.0.290. ([\matrix-org#16342](matrix-org#16342)) * Bump serde_json from 1.0.105 to 1.0.107. ([\matrix-org#16296](matrix-org#16296), [\matrix-org#16345](matrix-org#16345)) * Bump twisted from 22.10.0 to 23.8.0. ([\matrix-org#16235](matrix-org#16235)) * Bump types-pillow from 10.0.0.2 to 10.0.0.3. ([\matrix-org#16293](matrix-org#16293)) * Bump types-setuptools from 68.0.0.3 to 68.2.0.0. ([\matrix-org#16292](matrix-org#16292)) * Bump typing-extensions from 4.7.1 to 4.8.0. ([\matrix-org#16341](matrix-org#16341))
Fizzadar
added a commit
to beeper/synapse-legacy-fork
that referenced
this pull request
Oct 27, 2023
No significant changes since 1.93.0rc1. The following issues are fixed in 1.93.0 (and RCs). - [GHSA-4f74-84v3-j9q5](GHSA-4f74-84v3-j9q5) / [CVE-2023-41335](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-41335) — Low Severity Temporary storage of plaintext passwords during password changes. - [GHSA-7565-cq32-vx2x](GHSA-7565-cq32-vx2x) / [CVE-2023-42453](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2023-42453) — Low Severity Improper validation of receipts allows forged read receipts. See the advisories for more details. If you have any questions, email security@matrix.org. - Add automatic purge after all users have forgotten a room. ([\matrix-org#15488](matrix-org#15488)) - Restore room purge/shutdown after a Synapse restart. ([\matrix-org#15488](matrix-org#15488)) - Support resolving homeservers using `matrix-fed` DNS SRV records from [MSC4040](matrix-org/matrix-spec-proposals#4040). ([\matrix-org#16137](matrix-org#16137)) - Add the ability to use `G` (GiB) and `T` (TiB) suffixes in configuration options that refer to numbers of bytes. ([\matrix-org#16219](matrix-org#16219)) - Add span information to requests sent to appservices. Contributed by MTRNord. ([\matrix-org#16227](matrix-org#16227)) - Add the ability to enable/disable registrations when using CAS. Contributed by Aurélien Grimpard. ([\matrix-org#16262](matrix-org#16262)) - Allow the `/notifications` endpoint to be routed to workers. ([\matrix-org#16265](matrix-org#16265)) - Enable users to easily unsubscribe to notifications emails via the `List-Unsubscribe` header. ([\matrix-org#16274](matrix-org#16274)) - Report whether a user is `locked` in the [List Accounts admin API](https://matrix-org.github.io/synapse/latest/admin_api/user_admin_api.html#list-accounts), and exclude locked users by default. ([\matrix-org#16328](matrix-org#16328)) - Fix a long-standing bug where multi-device accounts could cause high load due to presence. ([\matrix-org#16066](matrix-org#16066), [\matrix-org#16170](matrix-org#16170), [\matrix-org#16171](matrix-org#16171), [\matrix-org#16172](matrix-org#16172), [\matrix-org#16174](matrix-org#16174)) - Fix a long-standing bug where appservices using [MSC2409](matrix-org/matrix-spec-proposals#2409) to receive `to_device` messages would only get messages for one user. ([\matrix-org#16251](matrix-org#16251)) - Fix bug when using workers where Synapse could end up re-requesting the same remote device repeatedly. ([\matrix-org#16252](matrix-org#16252)) - Fix long-standing bug where we kept re-requesting a remote server's key repeatedly, potentially causing delays in receiving events over federation. ([\matrix-org#16257](matrix-org#16257)) - Avoid temporary storage of sensitive information. ([\matrix-org#16272](matrix-org#16272)) - Fix bug introduced in Synapse 1.49.0 when using dehydrated devices ([MSC2697](matrix-org/matrix-spec-proposals#2697)) and refresh tokens. Contributed by Hanadi. ([\matrix-org#16288](matrix-org#16288)) - Fix a long-standing bug where invalid receipts would be accepted. ([\matrix-org#16327](matrix-org#16327)) - Use standard name for UTF-8 charset in emails. ([\matrix-org#16329](matrix-org#16329)) - Don't try refetching device lists for users on remote hosts that are marked as "down". ([\matrix-org#16298](matrix-org#16298)) - Fix typos in the documentation. ([\matrix-org#16282](matrix-org#16282)) - Link to the Alpine Linux community package for Synapse. ([\matrix-org#16304](matrix-org#16304)) - Use string for `federation_client_minimum_tls_version` documentation examples. Contributed by @jcgruenhage. ([\matrix-org#16353](matrix-org#16353)) - Allow modules to delete rooms. ([\matrix-org#15997](matrix-org#15997)) - Add GCC and GNU Make to the Nix flake development environment so that `ruff` can be compiled. ([\matrix-org#16090](matrix-org#16090), [\matrix-org#16263](matrix-org#16263)) - Fix type checking when using the new version of Twisted. ([\matrix-org#16235](matrix-org#16235)) - Delete device messages asynchronously and in staged batches using the task scheduler. ([\matrix-org#16240](matrix-org#16240), [\matrix-org#16311](matrix-org#16311), [\matrix-org#16312](matrix-org#16312), [\matrix-org#16313](matrix-org#16313)) - Bump minimum supported Rust version to 1.61.0. ([\matrix-org#16248](matrix-org#16248)) - Update rust to version 1.71.1 in the nix development environment. ([\matrix-org#16260](matrix-org#16260)) - Simplify server key storage. ([\matrix-org#16261](matrix-org#16261)) - Reduce CPU overhead of change password endpoint. ([\matrix-org#16264](matrix-org#16264)) - Stop purging from tables slated for removal. ([\matrix-org#16273](matrix-org#16273)) - Improve type hints. ([\matrix-org#16276](matrix-org#16276), [\matrix-org#16301](matrix-org#16301), [\matrix-org#16325](matrix-org#16325), [\matrix-org#16326](matrix-org#16326)) - Raise `setuptools_rust` version cap to 1.7.0. ([\matrix-org#16277](matrix-org#16277)) - Fix using the new task scheduler causing lots of CPU to be used. ([\matrix-org#16278](matrix-org#16278)) - Upgrade CI run of Python 3.12 from rc1 to rc2. ([\matrix-org#16280](matrix-org#16280)) - Include values in SQL debug when using `execute_values` with Postgres. ([\matrix-org#16281](matrix-org#16281)) - Enable additional linting checks. ([\matrix-org#16283](matrix-org#16283)) - Refactor `receipts_graph` Postgres transactions to stop error messages. ([\matrix-org#16299](matrix-org#16299)) - Small improvements to logging in replication code. ([\matrix-org#16309](matrix-org#16309)) - Remove a reference cycle in background processes. ([\matrix-org#16314](matrix-org#16314)) - Only use literal strings for background process names. ([\matrix-org#16315](matrix-org#16315)) - Refactor `get_user_by_id`. ([\matrix-org#16316](matrix-org#16316)) - Speed up task to delete to-device messages. ([\matrix-org#16318](matrix-org#16318)) - Avoid patching code in tests. ([\matrix-org#16349](matrix-org#16349)) - Test against PostgreSQL 16. ([\matrix-org#16351](matrix-org#16351)) * Bump mypy from 1.4.1 to 1.5.1. ([\matrix-org#16300](matrix-org#16300)) * Bump black from 23.7.0 to 23.9.1. ([\matrix-org#16295](matrix-org#16295)) * Bump docker/build-push-action from 4 to 5. ([\matrix-org#16336](matrix-org#16336)) * Bump docker/login-action from 2 to 3. ([\matrix-org#16339](matrix-org#16339)) * Bump docker/metadata-action from 4 to 5. ([\matrix-org#16337](matrix-org#16337)) * Bump docker/setup-qemu-action from 2 to 3. ([\matrix-org#16338](matrix-org#16338)) * Bump furo from 2023.8.19 to 2023.9.10. ([\matrix-org#16340](matrix-org#16340)) * Bump gitpython from 3.1.32 to 3.1.35. ([\matrix-org#16267](matrix-org#16267), [\matrix-org#16279](matrix-org#16279)) * Bump mypy-zope from 1.0.0 to 1.0.1. ([\matrix-org#16291](matrix-org#16291)) * Bump pillow from 10.0.0 to 10.0.1. ([\matrix-org#16344](matrix-org#16344)) * Bump regex from 1.9.4 to 1.9.5. ([\matrix-org#16233](matrix-org#16233)) * Bump ruff from 0.0.286 to 0.0.290. ([\matrix-org#16342](matrix-org#16342)) * Bump serde_json from 1.0.105 to 1.0.107. ([\matrix-org#16296](matrix-org#16296), [\matrix-org#16345](matrix-org#16345)) * Bump twisted from 22.10.0 to 23.8.0. ([\matrix-org#16235](matrix-org#16235)) * Bump types-pillow from 10.0.0.2 to 10.0.0.3. ([\matrix-org#16293](matrix-org#16293)) * Bump types-setuptools from 68.0.0.3 to 68.2.0.0. ([\matrix-org#16292](matrix-org#16292)) * Bump typing-extensions from 4.7.1 to 4.8.0. ([\matrix-org#16341](matrix-org#16341)) # -----BEGIN PGP SIGNATURE----- # # iQFEBAABCgAuFiEEBTGR3/RnAzBGUif3pULk7RsPrAkFAmUS8iEQHGVyaWtAbWF0 # cml4Lm9yZwAKCRClQuTtGw+sCXFgB/912+T+BydS290UECCXp9kpRB5xo3aWe8mX # NCx9Oor1TRLBpLhlQWk786gP1Q9JAQpmA4z6kovjKaLG1b4oLbZNjbPG4hEYc8ow # /rVzGor52pfyS7uS5GW+rRmapcw4AYND6hA9XGELupf2joC8LXioSCEVG4cxwD8E # IgIbLc87C7KpaUkNbDEz3jzZ3/BVRGcIYyhF3zTK2ZApvH2qsegq8wKYx4EYJnfh # 87DXtTCNwA+bW6XZYPtUwPKjZ+TGB11IizxmQySGLbAxvH+GUan8X8TizGyxaqaA # FDk3yMBbUo0R7ljDgL5YsZXT6qsZz+IBz/bsMzSbZ39f/yEUqHak # =1/pL # -----END PGP SIGNATURE----- # gpg: Signature made Tue Sep 26 16:00:49 2023 BST # gpg: using RSA key 053191DFF4670330465227F7A542E4ED1B0FAC09 # gpg: issuer "erik@matrix.org" # gpg: Can't check signature: No public key # Conflicts: # .github/workflows/docker.yml # .github/workflows/push_complement_image.yml # .github/workflows/release-artifacts.yml # .github/workflows/tests.yml # poetry.lock # synapse/appservice/scheduler.py # synapse/handlers/pagination.py # synapse/handlers/room.py # synapse/rest/client/account_data.py # tests/rest/client/test_receipts.py
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This attempts to simplify some of the presence code by reducing duplicated code between worker & non-worker modes.
The main change is to drive more of the logic into
set_state
(fromuser_syncing
) by passing in whether the user is setting it via a/sync
or not with a newis_sync
flag. If this istrue
some additional logic is performed (in this new, single location):busy
presence.last_user_sync_ts
.The third commit also simplifies some minor logic of whether "busy" is enabled or not.
And finally, the last commit avoids duplicate logic where the presence state from a worker was being set multiple times, once via a replication call to
set_state(...)
and once via theUSER_SYNC
message.Spun out of #16066.