aboutsummaryrefslogtreecommitdiff
path: root/syncapi
AgeCommit message (Collapse)Author
2024-08-03Fixing Presence Conflicts (#3320)jjj333_p
This is meant to cache client presence for a moment so that it doesn't oscillate. Currently Dendrite just federates out whatever presence it gets from the sync loop, which means if theres any clients attempting to sync without setting the user online, and there is an online client, it will just flip back and forth each time one of the clients polls /sync. This pull request essentially stores in a map when the client last set online ideally to allow the online client to sync again and set an online presence before setting idle or offline. I am not great at programming nor am I familiar with this codebase so if this pr is just shitwater feel free to discard, just trying to fix an issue that severely bothers me. If it is easier you can also steal the code and write it in yourself. I ran the linter, not sure that it did anything, the vscode go extension seems to format and lint anyways. I tried to run unit tests but I have no idea any of this thing. it errors on `TestRequestPool_updatePresence/same_presence_is_not_published_dummy2 (10m0s)` which I think making this change broke. I am unsure how to comply, if y'all point me in the right direction ill try to fix it. I have tested it with all the situations I can think of on my personal instance pain.agency, and this seems to stand up under all the previously bugged situations. ~~My go also decided to update a bunch of the dependencies, I hate git and github and have no idea how to fix that, it was not intentional.~~ i just overwrote them with the ones from the main repo and committed it, seems to have done what was needed. ### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: `Joseph Winkie <jjj333.p.1325@gmail.com>` --------- Co-authored-by: Till Faelligen <2353100+S7evinK@users.noreply.github.com>
2024-07-27Fix: Edited messages appear twice in fulltext search (#3363)Alex
As stated in https://github.com/matrix-org/dendrite/issues/3358 the search response contains both original and edited message. This PR fixes it by removing of the original message from the fulltext index after indexing the edit message event. I also made some cosmetic changes/fixes i found in the code Signed-off-by: `Alexander Dubovikov <d.lexand@gmail.com>`
2024-02-20Limit filter to `limit/2` for before/after events on `/context` (#3332)Till
Part of https://github.com/matrix-org/dendrite/issues/3224
2024-01-29Fix x86 tests (#3317)Till
x86 tests broke with #3298 (Not exactly the tests modified here, but `TestMessageHistoryVisibility`)
2024-01-25Move `/joined_members` back to the clientapi/roomserver (#3312)Till
Partly reverts #2827 by moving `/joined_members` back to the clientAPI/roomserver
2024-01-25Only fetch events once for all rooms (#3311)Joakim Recht
This refactors `PDUStreamProvider` a bit so that it doesn't trigger a database query per room, but instead utilizes the fact that it's possible to bulk query. This improves sync performance significantly when you have 1000s of rooms. ### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below using a legally identifiable name](https://matrix-org.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: `Joakim Recht <joakim@beyondwork.ai>`
2024-01-09Handle empty from in /messages as per MSC3567 (#3298)devonh
2023-12-12Introduce a new stream for the appservice consumer (#3277)Till
This introduces a new stream the syncAPI produces to once it processed a `OutputRoomEvent` and the appservices consumes. This is to work around a race condition where appservices receive an event before the syncAPI has handled it, this can result in e.g. calls to `/joined_members` returning a wrong membership list.
2023-11-09More `rows.Close()` and `rows.Err()` (#3262)Till
Looks like we missed some `rows.Close()` Even though `rows.Err()` is mostly not necessary, we should be more consistent in the DB layer. [skip ci]
2023-11-08Fix potential connection leak (#3247)Till
We didn't rollback/commit after getting events, now we're rolling back since we didn't change anything.
2023-09-28Fix tests for x86 (#3214)Till
2023-09-26Complement fixes for pseudoIDs (#3206)devonh
2023-09-15Move pseudoID ClientEvent hotswapping to a common location (#3199)devonh
Fixes a variety of issues where clients were receiving pseudoIDs in places that should be userIDs. This change makes pseudoIDs work with sliding sync & element x. --------- Co-authored-by: Till <2353100+S7evinK@users.noreply.github.com>
2023-09-15Update gmsl to use new validated RoomID on PDUs (#3200)devonh
GMSL returns a `spec.RoomID` when calling `PDU.RoomID()`
2023-09-12[pseudoIDs] changing event ID fix (#3195)Sam Wedgwood
power levels events in pseudo IDs sometimes changed event IDs (this was already fixed earlier, but one of the edgecases was not covered, and is now covered) Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-08-31Handle event_format federation in /sync responses (#3192)devonh
2023-08-24[pseudoIDs] More pseudo ID fixes - Part 2 (#3181)Sam Wedgwood
Fixes include: - Translating state keys that contain user IDs to their respective room keys for both querying and sending state events - **NOTE**: there may be design discussion needed on what should happen when sender keys cannot be found for users - A simple fix for kicking guests from rooms properly - Logic for boundary history visibilities was slightly off (I'm surprised this only manifested in pseudo ID room versions) Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-08-15[pseudoID] More pseudo ID fixes (#3167)Sam Wedgwood
Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-08-02Use `*spec.SenderID` for `QuerySenderIDForUser` (#3164)Sam Wedgwood
There are cases where a dendrite instance is unaware of a pseudo ID for a user, the user is not a member of that room. To represent this case, we currently use the 'zero' value, which is often not checked and so causes errors later down the line. To make this case more explict, and to be consistent with `QueryUserIDForSender`, this PR changes this to use a pointer (and `nil` to mean no sender ID). Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-07-31[pseudoIDs] Fixes for room alias tests (#3159)Sam Wedgwood
Some (deceptively) simple fixes for some bugs that caused room alias tests to fail (sytext `tests/30rooms/05aliases.pl`). Each commit has details about what it fixes. Sytest results: - Sytest before (79d4a0e): https://gist.github.com/swedgwood/972ac4ef93edd130d3db0930703d6c82 - Sytest after (4b09bed): https://gist.github.com/swedgwood/504b00ac4ee892acb757b7fac55fa28a Room aliases go from `8/15` to `15/15`, but looks like these fixes also managed to fix about `4` other tests, which is a nice bonus :) Signed-off-by: `Sam Wedgwood <sam@wedgwood.dev>`
2023-07-19Use pointer when passing the connection manager around (#3152)Till
As otherwise existing connections aren't reused.
2023-07-14Discard "illegal base64 data at input byte 0" errors in the SyncAPITill Faelligen
2023-07-13Tweaks around `/messages` (#3149)Till
Try to mitigate some issues with `/messages`
2023-07-08Avoid loops by setting end to an empty string if start == end (#3146)Till
2023-07-07Fix issues reported by Sentry (#3143)Till
This should fix a few issues reported by Sentry
2023-07-06Populate syncapi state event prev_sender with userID (#3142)devonh
2023-07-06Fix prev event lookup in syncapi (#3141)devonh
The syncapi operates using userID's so when querying for the previous state event we need to lookup the userID from the given senderID before the state query.
2023-07-06Add pseudoID compatibility to Invites (#3126)devonh
2023-06-28Add `MXIDMapping` for pseudoID rooms (#3112)Till
Add `MXIDMapping` on membership events when creating/joining rooms.
2023-06-28Fix syncAPI redactions (#3118)Till
Previously we were setting `redacted_because` to the PDU event, but as per the spec it should really be a client event. This fixes it.
2023-06-14Merge SenderID & Per Room User Key work (#3109)devonh
2023-06-13Add `sender_key` to ClientEvent (#3110)Till
2023-06-12Cleanup remaining statekey usage for senderIDs (#3106)devonh
2023-06-07Use SenderID Type (#3105)devonh
2023-06-06PDU Sender split (#3100)devonh
Initial cut of splitting PDU Sender into SenderID & looking up UserID where required.
2023-06-02Fix newly found linter issues (#3099)Till
Fixes the issues found in https://github.com/matrix-org/dendrite/actions/runs/5155539352/jobs/9285342056#step:5:22. Only naked returns in longer functions.
2023-05-30Docs restructure (#2953)Till
Needs to be merged into `gh-pages` later on.
2023-05-17Move MakeJoin logic to GMSL (#3081)devonh
2023-05-09Move json errors over to gmsl (#3080)devonh
2023-05-03Use PDU in even more places (#3074)kegsay
- No longer rely on *Event returning from NewEventFrom... functions Requires https://github.com/matrix-org/gomatrixserverlib/pull/377
2023-05-02Use PDU not *Event in HeaderedEvent (#3073)kegsay
Requires https://github.com/matrix-org/gomatrixserverlib/pull/376 This has numerous upsides: - Less type casting to `*Event` is required. - Making Dendrite work with `PDU` interfaces means we can swap out Event impls more easily. - Tests which represent weird event shapes are easier to write. Part of a series of refactors on GMSL.
2023-04-28Use PDU in more places (#3072)kegsay
2023-04-27Use PDU interface (#3070)kegsay
We only use it in a few places currently, enough to get things to compile and run. We should be using it in much more places. Similarly, in some places we cast []PDU back to []*Event, we need to not do that. Likewise, in some places we cast PDU to *Event, we need to not do that. For now though, hopefully this is a start.
2023-04-27Remove gmsl.HeaderedEvent (#3068)kegsay
Replaced with types.HeaderedEvent _for now_. In reality we want to move them all to gmsl.Event and only use HeaderedEvent when we _need_ to bundle the version/event ID with the event (seriailsation boundaries, and even then only when we don't have the room version). Requires https://github.com/matrix-org/gomatrixserverlib/pull/373
2023-04-21Implement new RoomVersionImpl API (#3062)kegsay
As outlined in https://github.com/matrix-org/gomatrixserverlib/pull/368 The main change Dendrite side is that `RoomVersion` no longer has any methods on it. Instead, you need to bounce via `gmsl.GetRoomVersion`. It's very interesting to see where exactly Dendrite cares about this. For some places it's creating events (fine) but others are way more specific. Those areas will need to migrate to GMSL at some point.
2023-04-20refactor: funnel event creation through room versions (#3060)kegsay
In preparation of interfacing up the room version value.
2023-04-19refactor: update GMSL (#3058)kegsay
Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/364 Read this commit by commit to avoid going insane.
2023-04-17Add sync API db tests (#3043)Till
Co-authored-by: kegsay <kegan@matrix.org>
2023-04-04Move GMSL client types to Dendrite (#3045)kegsay
GMSL is intended for Federation only. Sister PR to https://github.com/matrix-org/gomatrixserverlib/pull/357
2023-03-27Add `/search` tests (#3025)Till