This adds a new behavior
on sync that the app
automatically fetches the
last event from server
after we receive a
limited timeline and the
lastEvent has not
changed.
This adds a check before the storeRoomUpdate() call
if the room is actually known. This has the effect
that the call of forgetRoom() is skipped.
The reason for this is an edge case in the database
implementation when calling getAllKeys(). This
somehow can corrupt the keys-cache and lead to
some problems. I wasn't able to fix this problem
yet so this refactoring is more a good-enough
workaround for now to not trigger it on an
initial sync. I plan to fix it with a different
approach which completely removes the keys-cache
in the future.
However this change leads to some problems in the
tests as they already rely on this edge case.
We actually never use the
roomId of this type and the
matrix spec has changed in
a way that the roomId is
never sent there actually. So
it was super easy to just
replace all BasicRoomEvent
with BasicEvent. The roomId
became nullable anyway.
This fixes a huge performance
leak as for every encrypted room
the whole member list is loaded
every time you start the client.
This also changes the default value of `cache` in
this method to if the room is encrypted or not.
For encrypted rooms we always want a complete
member list locally.
This was added in 77be6102f6 without much
documentation. I am pretty sure the intent was never to slow down every
test by 5 seconds, so let's get rid of it and do more careful delays
where it is useful (like specific sync requests for example).
Makes the tests run 5 times faster (the whole suite!) on my device.
This should speed up loading the archived rooms. One of the reasons it
was so slow, is because we were loading all room members!
Additionally this may work around a bug in Synapse, where rooms stuck in
their partial state may block sync indefinitely.
Relates to https://github.com/famedly/product-management/issues/2250
This completely redoes the requestUser function.
It now doesn't stop requesting a user forever just because of a network
error. But redundant calls are still deduplicated, however their
parameters are taken into account now.
It also now only calls onUpdate and onRoomState when there is actually
new state. This way apps can just listen to updates to rerender instead
of having to implement the deduplication themselves.
It also now doesn't treat member events without membership as "join"
anymore. And lookup errors don't cause an empty user to get inserted
into the room state.
In general this should still request the profile from the server, if the
displayname is unset in a leave event, but it should also allow the app
to actually settle in the tests.