-
-
Notifications
You must be signed in to change notification settings - Fork 600
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't re-fetch thread root if we already have it #4088
Conversation
The root event of a thread used to arrive with the pagination request, but this was unspecced and so got changed to simply fetch the root event. In many (almost all) cases this shouldn't be necessary because the thread should already have its root event: re-use it if it's already there. This is only in pagination, so there's no reason to believe that the root event would have changed and needs to be re-fetched. This removes a number of duplicate calls to the /event/ endpoint from the tests.
@@ -1643,7 +1635,7 @@ describe("MatrixClient event timelines", function () { | |||
...THREAD_ROOT.unsigned!["m.relations"], | |||
"io.element.thread": { | |||
...THREAD_ROOT.unsigned!["m.relations"]!["io.element.thread"], | |||
count: 2, | |||
count: 1, |
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.
This is a weird one. The event that's being added to the thread here is a reaction and so should not increment this number since it's not a thread-type relation. The test later asserts that the thread reply count is still 1: essentially that this value was ignored. As far as I can see, it was only ignored (and therefore passing) by some race condition in the test. Because there's one less async call, the new value now propagates through. As far as I can see this is just the wrong number here and should be 1.
Another question is whether it's still useful for the test to assert the reply count later. I've left it in for now.
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.
Looks sane
And from the actual application, right? RIGHT? |
Indeed, yes, should be slightly fewer requests. |
* v31.5.0-rc.0 * Don't re-fetch thread root if we already have it (matrix-org#4088) The root event of a thread used to arrive with the pagination request, but this was unspecced and so got changed to simply fetch the root event. In many (almost all) cases this shouldn't be necessary because the thread should already have its root event: re-use it if it's already there. This is only in pagination, so there's no reason to believe that the root event would have changed and needs to be re-fetched. This removes a number of duplicate calls to the /event/ endpoint from the tests. * Fix race condition with sliding sync extensions (matrix-org#4089) * Fix race condition with sliding sync extensions * Fix types on sliding-sync spec test * Prettier fixes * Add `.m.rule.is_room_mention` push rule to DEFAULT_OVERRIDE_RULES (matrix-org#4100) * Add intentional mentions push rules to DEFAULT_OVERRIDE_RULES Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Export types describing all specced media event formats (matrix-org#4092) * Export types describing all specced media event formats Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate PR Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move types to a dedicated export Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add readme entry Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update dependency typedoc to v0.25.11 (matrix-org#4102) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v31.5.0 * Resetting package fields for development * Temporarily disable broken step in the release process Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * fix automatic DM avatar with functional members (matrix-org#4017) * fix automatic DM avatar with functional members * update comments * lint * add tests for functional members * keep functional members out of the public API - remove public API for functional members, reverting most of 0ce2d82, f9b41f6, e65fb24 - remove tests for functional members public API c114bf5 - add shared functional members getter for both room name and avatar fallback generation * filter functional members from more candidates - remove from hero(es) - remove from previous members * add tests for fallback avatars with functional members * Add docstring for getFunctionalMembers Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * inline getInvitedAndJoinedFunctionalMemberCount * update comments for getAvatarFallbackMember * use correct list of heroes in getAvatarFallbackMember * remove redundant type annotation * optimize performance of invitedAndJoinedFunctionalMemberCount * calculate nonFunctionalMemberCount in one step instead of iterating redundantly * clean up functional member tests with review feedback * lint * Update src/models/room.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * apply feedback about comments * non-functional per review, lint --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: RiotRobot <releases@riot.im> Co-authored-by: David Baker <dbkr@users.noreply.github.com> Co-authored-by: Daniel Salinas <zzorba@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Kim Brose <2803622+HarHarLinks@users.noreply.github.com> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* v31.5.0-rc.0 * Don't re-fetch thread root if we already have it (matrix-org#4088) The root event of a thread used to arrive with the pagination request, but this was unspecced and so got changed to simply fetch the root event. In many (almost all) cases this shouldn't be necessary because the thread should already have its root event: re-use it if it's already there. This is only in pagination, so there's no reason to believe that the root event would have changed and needs to be re-fetched. This removes a number of duplicate calls to the /event/ endpoint from the tests. * Fix race condition with sliding sync extensions (matrix-org#4089) * Fix race condition with sliding sync extensions * Fix types on sliding-sync spec test * Prettier fixes * Add `.m.rule.is_room_mention` push rule to DEFAULT_OVERRIDE_RULES (matrix-org#4100) * Add intentional mentions push rules to DEFAULT_OVERRIDE_RULES Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Export types describing all specced media event formats (matrix-org#4092) * Export types describing all specced media event formats Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate PR Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move types to a dedicated export Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add readme entry Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update dependency typedoc to v0.25.11 (matrix-org#4102) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v31.5.0 * Resetting package fields for development * Temporarily disable broken step in the release process Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * fix automatic DM avatar with functional members (matrix-org#4017) * fix automatic DM avatar with functional members * update comments * lint * add tests for functional members * keep functional members out of the public API - remove public API for functional members, reverting most of 0ce2d82, f9b41f6, e65fb24 - remove tests for functional members public API c114bf5 - add shared functional members getter for both room name and avatar fallback generation * filter functional members from more candidates - remove from hero(es) - remove from previous members * add tests for fallback avatars with functional members * Add docstring for getFunctionalMembers Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * inline getInvitedAndJoinedFunctionalMemberCount * update comments for getAvatarFallbackMember * use correct list of heroes in getAvatarFallbackMember * remove redundant type annotation * optimize performance of invitedAndJoinedFunctionalMemberCount * calculate nonFunctionalMemberCount in one step instead of iterating redundantly * clean up functional member tests with review feedback * lint * Update src/models/room.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * apply feedback about comments * non-functional per review, lint --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: RiotRobot <releases@riot.im> Co-authored-by: David Baker <dbkr@users.noreply.github.com> Co-authored-by: Daniel Salinas <zzorba@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Kim Brose <2803622+HarHarLinks@users.noreply.github.com> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* v31.5.0-rc.0 * Don't re-fetch thread root if we already have it (matrix-org#4088) The root event of a thread used to arrive with the pagination request, but this was unspecced and so got changed to simply fetch the root event. In many (almost all) cases this shouldn't be necessary because the thread should already have its root event: re-use it if it's already there. This is only in pagination, so there's no reason to believe that the root event would have changed and needs to be re-fetched. This removes a number of duplicate calls to the /event/ endpoint from the tests. * Fix race condition with sliding sync extensions (matrix-org#4089) * Fix race condition with sliding sync extensions * Fix types on sliding-sync spec test * Prettier fixes * Add `.m.rule.is_room_mention` push rule to DEFAULT_OVERRIDE_RULES (matrix-org#4100) * Add intentional mentions push rules to DEFAULT_OVERRIDE_RULES Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Export types describing all specced media event formats (matrix-org#4092) * Export types describing all specced media event formats Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate PR Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Move types to a dedicated export Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Add readme entry Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update dependency typedoc to v0.25.11 (matrix-org#4102) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * v31.5.0 * Resetting package fields for development * Temporarily disable broken step in the release process Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * fix automatic DM avatar with functional members (matrix-org#4017) * fix automatic DM avatar with functional members * update comments * lint * add tests for functional members * keep functional members out of the public API - remove public API for functional members, reverting most of 0ce2d82, f9b41f6, e65fb24 - remove tests for functional members public API c114bf5 - add shared functional members getter for both room name and avatar fallback generation * filter functional members from more candidates - remove from hero(es) - remove from previous members * add tests for fallback avatars with functional members * Add docstring for getFunctionalMembers Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * inline getInvitedAndJoinedFunctionalMemberCount * update comments for getAvatarFallbackMember * use correct list of heroes in getAvatarFallbackMember * remove redundant type annotation * optimize performance of invitedAndJoinedFunctionalMemberCount * calculate nonFunctionalMemberCount in one step instead of iterating redundantly * clean up functional member tests with review feedback * lint * Update src/models/room.ts Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> * apply feedback about comments * non-functional per review, lint --------- Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: RiotRobot <releases@riot.im> Co-authored-by: David Baker <dbkr@users.noreply.github.com> Co-authored-by: Daniel Salinas <zzorba@users.noreply.github.com> Co-authored-by: Michael Telatynski <7t3chguy@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Kim Brose <2803622+HarHarLinks@users.noreply.github.com> Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
The root event of a thread used to arrive with the pagination request, but this was unspecced and so got changed to simply fetch the root event. In many (almost all) cases this shouldn't be necessary because the thread should already have its root event: re-use it if it's already there. This is only in pagination, so there's no reason to believe that the root event would have changed and needs to be re-fetched.
This removes a number of duplicate calls to the /event/ endpoint from the tests.
Checklist