Commit graph

1855 commits

Author SHA1 Message Date
Till Faelligen f798baa618 Cleanup 2022-03-04 08:57:16 +01:00
Till Faelligen 8500f82149 Move phone home stats to util package 2022-03-04 08:48:10 +01:00
Till Faelligen 623df231ee Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/phonehomestats 2022-03-04 08:21:44 +01:00
Neil Alexander f75169c353
Send profile updates asynchronously (#2246) 2022-03-03 18:24:14 +00:00
Neil Alexander 72022a6ecf
Return 404 if event given to /context was not found (#2245) 2022-03-03 17:58:24 +00:00
Neil Alexander 5592322e13
Clean old notifications regularly (#2244)
* Clean old notifications regularly

We'll keep highlights for a month and non-highlights for a day, to stop the `userapi_notifications` table from growing indefinitely.

We'll also allow storing events even if no pushers are present, because apparently Element Web expects to work that way.

* Fix the milliseconds

* Use process context

* Update sytest lists

* Fix build issue
2022-03-03 16:45:06 +00:00
Till Faelligen c44029f269 Don't open two connections for the userapi 2022-03-03 17:04:18 +01:00
Till Faelligen c1989c024c Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/phonehomestats 2022-03-03 16:56:00 +01:00
Till Faelligen b07c31da22 Move stats to the userapi 2022-03-03 16:47:26 +01:00
Till Faelligen 845363253a Add more fields, actually send data somewhere 2022-03-03 16:19:45 +01:00
Neil Alexander b6b2455ecd
Test /context/ with lazy_load_members filter works should be OK now 2022-03-03 14:01:14 +00:00
Neil Alexander 43ab0288f4
Give more time to TestSessionCleanUp tests 2022-03-03 12:37:12 +00:00
Neil Alexander 6ed8cf0e07
Handle ErrNoRows when sending read updates 2022-03-03 12:09:16 +00:00
Neil Alexander bcc27e9e18
Only store notifications for users with pushers, de-parallelise TestSessionCleanUp for now 2022-03-03 12:01:19 +00:00
Dan f05ce478f0
Implement Push Notifications (#1842)
* Add Pushserver component with Pushers API

Co-authored-by: Tommie Gannert <tommie@gannert.se>
Co-authored-by: Dan Peleg <dan@globekeeper.com>

* Wire Pushserver component

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>

* Add PushGatewayClient.

The full event format is required for Sytest.

* Add a pushrules module.

* Change user API account creation to use the new pushrules module's defaults.

Introduces "scope" as required by client API, and some small field
tweaks to make some 61push Sytests pass.

* Add push rules query/put API in Pushserver.

This manipulates account data over User API, and fires sync messages
for changes. Those sync messages should, according to an existing TODO
in clientapi, be moved to userapi.

Forks clientapi/producers/syncapi.go to pushserver/ for later extension.

* Add clientapi routes for push rules to Pushserver.

A cleanup would be to move more of the name-splitting logic into
pushrules.go, to depollute routing.go.

* Output rooms.join.unread_notifications in /sync.

This is the read-side. Pushserver will be the write-side.

* Implement pushserver/storage for notifications.

* Use PushGatewayClient and the pushrules module in Pushserver's room consumer.

* Use one goroutine per user to avoid locking up the entire server for
  one bad push gateway.
* Split pushing by format.
* Send one device per push. Sytest does not support coalescing
  multiple devices into one push. Matches Synapse. Either we change
  Sytest, or remove the group-by-url-and-format logic.
* Write OutputNotificationData from push server. Sync API is already
  the consumer.

* Implement read receipt consumers in Pushserver.

Supports m.read and m.fully_read receipts.

* Add clientapi route for /unstable/notifications.

* Rename to UpsertPusher for clarity and handle pusher update

* Fix linter errors

* Ignore body.Close() error check

* Fix push server internal http wiring

* Add 40 newly passing 61push tests to whitelist

* Add next 12 newly passing 61push tests to whitelist

* Send notification data before notifying users in EDU server consumer

* NATS JetStream

* Goodbye sarama

* Fix `NewStreamTokenFromString`

* Consume on the correct topic for the roomserver

* Don't panic, NAK instead

* Move push notifications into the User API

* Don't set null values since that apparently causes Element upsetti

* Also set omitempty on conditions

* Fix bug so that we don't override the push rules unnecessarily

* Tweak defaults

* Update defaults

* More tweaks

* Move `/notifications` onto `r0`/`v3` mux

* User API will consume events and read/fully read markers from the sync API with stream positions, instead of consuming directly

Co-authored-by: Piotr Kozimor <p1996k@gmail.com>
Co-authored-by: Tommie Gannert <tommie@gannert.se>
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-03-03 11:40:53 +00:00
Till Faelligen c60422191e Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/phonehomestats 2022-03-03 11:16:41 +01:00
Till Faelligen b4089a34f3 Add total rooms 2022-03-03 11:16:29 +01:00
Till Faelligen dad6289bf3 Add tracing methods 2022-03-03 11:15:08 +01:00
Till Faelligen a60c307be2 Move WASM to its own file, add config and comments 2022-03-03 10:53:31 +01:00
Till Faelligen 8e5f913e0b Add configuration for phone home stats 2022-03-03 10:52:53 +01:00
Neil Alexander 111f01ddc8
Update sytest-whitelist for changes in matrix-org/sytest#1200 2022-03-03 09:18:40 +00:00
Till Faelligen 5ffb386a25 Add version & monolith stats 2022-03-02 17:11:29 +01:00
Till Faelligen e1eaa74f8b Send empty request 2022-03-02 16:41:13 +01:00
Till Faelligen 4e789ab46a Fix queries 2022-03-02 16:31:50 +01:00
Till Faelligen 9f5c963dac add missing files 2022-03-02 16:17:01 +01:00
Till Faelligen 4454d33c34 Add complete config to syncapi 2022-03-02 16:14:43 +01:00
Till Faelligen d7d7919cea testing phone home stats 2022-03-02 16:14:04 +01:00
Till Faelligen 2747c9eae2 sycnapi stats queries 2022-03-02 16:13:46 +01:00
Till Faelligen 9897a6e186 userapi interface and internal api 2022-03-02 16:13:00 +01:00
Till Faelligen a01ebba787 userapi stats tables & queries 2022-03-02 16:12:44 +01:00
Kegan Dougal e46a61c49e Skip flakey test for now 2022-03-02 11:38:13 +00:00
Neil Alexander 8996cc8059
Media endpoints on /v3 (#2242)
* Media endpoints on `/v3`

* Keep `/v1` too?
2022-03-02 11:35:35 +00:00
Till Faelligen 104a0fbf8f Fix queries 2022-03-02 12:04:00 +01:00
Till Faelligen d8611efbd7 Add user_daily_visits table 2022-03-02 11:55:45 +01:00
Kegan Dougal a4c918ee17 Fix data race in unit tests 2022-03-02 10:49:36 +00:00
Neil Alexander 00b3545b14
Update NATS Server to v2.7.3 2022-03-02 10:36:20 +00:00
Till Faelligen 3f0ed455b0 Add userAgent to UpdateDeviceLastSeen
Add new Table for tracking daily user vists
2022-03-02 09:53:49 +01:00
Till Faelligen 9e14e6afe0 Merge branch 'main' of github.com:matrix-org/dendrite into s7evink/phonehomestats 2022-03-02 08:36:49 +01:00
Neil Alexander 849e40d456
Use correct stream provider in Latest for ReceiptPosition 2022-03-01 17:25:26 +00:00
kegsay 23f028cf6e
Add unit test for device list update debouncing (#2220)
* Add unit test for device list update debouncing

* bugfix: actually return stale device lists in the test...

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-03-01 17:18:06 +00:00
Neil Alexander 8e82739d77
Set max age of 5 minutes for spaces summary cache 2022-03-01 17:01:08 +00:00
Neil Alexander bb2380c254
Allow specifying max age for caches (#2239)
* Allow specifying max age for caches

* Evict cache entry if it's found to be stale when we call Get

* Fix bugs
2022-03-01 16:59:52 +00:00
Neil Alexander 726529fe99
Hopefully fix read receipts (#2241) 2022-03-01 16:59:11 +00:00
S7evinK cda2452ba0
Only allow device deletion from session UIA was initiated from (#2235)
* Only allow device deletion if the session matches

* Make the challenge response available to other packages

* Remove userID, as it's not in the spec

* Remove tests

* Add passing test & remove obsolete config

* Rename field, add comment

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-03-01 16:39:57 +00:00
kegsay 352e63915f
msc2946: add federation cache (#2238) 2022-03-01 16:32:48 +00:00
kegsay ae840590b6
Make complement go fast (#2240) 2022-03-01 16:03:54 +00:00
Till Faelligen 241f1514b7 Initial phone home stats queries 2022-03-01 15:54:07 +01:00
Kegan Dougal 8dfc958ddd Also don't send null back when the target room isn't a space room 2022-03-01 14:40:55 +00:00
S7evinK af610df85a
Return state on calls to /message and lazy load members (#2218)
Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-03-01 14:39:56 +00:00
Neil Alexander 471fda810a
Remove unnecessary error line (#2237)
Previously this error line would print because we were pulling out all user memberships, but now this is no longer necessary — an event state key that we don't know will no longer get passed to `SelectJoinedUsersSetForRooms` at all.
2022-03-01 14:39:06 +00:00