mirror of
https://gitlab.com/famedly/conduit.git
synced 2024-11-26 19:22:29 +00:00
Merge branch 'fix-sync' into 'master'
fix: too many syncs See merge request famedly/conduit!82
This commit is contained in:
commit
488581cc51
@ -103,6 +103,11 @@ pub async fn sync_events_route(
|
|||||||
// The inner Option is None when there is an event, but there is no state hash associated
|
// The inner Option is None when there is an event, but there is no state hash associated
|
||||||
// with it. This can happen for the RoomCreate event, so all updates should arrive.
|
// with it. This can happen for the RoomCreate event, so all updates should arrive.
|
||||||
let first_pdu_before_since = db.rooms.pdus_until(sender_user, &room_id, since).next();
|
let first_pdu_before_since = db.rooms.pdus_until(sender_user, &room_id, since).next();
|
||||||
|
let pdus_after_since = db
|
||||||
|
.rooms
|
||||||
|
.pdus_after(sender_user, &room_id, since)
|
||||||
|
.next()
|
||||||
|
.is_some();
|
||||||
|
|
||||||
let since_shortstatehash = first_pdu_before_since.as_ref().map(|pdu| {
|
let since_shortstatehash = first_pdu_before_since.as_ref().map(|pdu| {
|
||||||
db.rooms
|
db.rooms
|
||||||
@ -116,7 +121,7 @@ pub async fn sync_events_route(
|
|||||||
invited_member_count,
|
invited_member_count,
|
||||||
joined_since_last_sync,
|
joined_since_last_sync,
|
||||||
state_events,
|
state_events,
|
||||||
) = if Some(current_shortstatehash) != since_shortstatehash {
|
) = if pdus_after_since && Some(current_shortstatehash) != since_shortstatehash {
|
||||||
let current_state = db.rooms.room_state_full(&room_id)?;
|
let current_state = db.rooms.room_state_full(&room_id)?;
|
||||||
let current_members = current_state
|
let current_members = current_state
|
||||||
.iter()
|
.iter()
|
||||||
|
Loading…
Reference in New Issue
Block a user