fix: delta calculation

next
Timo Kösters 2021-08-14 19:07:50 +02:00
parent 3cf0145bc5
commit 38effda799
No known key found for this signature in database
GPG Key ID: 356E705610F626D5
2 changed files with 21 additions and 3 deletions

View File

@ -108,7 +108,7 @@ fn default_db_cache_capacity_mb() -> f64 {
} }
fn default_sqlite_wal_clean_second_interval() -> u32 { fn default_sqlite_wal_clean_second_interval() -> u32 {
15 * 60 // every 15 minutes 1 * 60 // every minute
} }
fn default_max_request_size() -> u32 { fn default_max_request_size() -> u32 {

View File

@ -510,10 +510,19 @@ impl Rooms {
for removed in statediffremoved { for removed in statediffremoved {
if !parent_new.remove(&removed) { if !parent_new.remove(&removed) {
// It was not added in the parent and we removed it
parent_removed.insert(removed); parent_removed.insert(removed);
} }
// Else it was added in the parent and we removed it again. We can forget this change
}
for new in statediffnew {
if !parent_removed.remove(&new) {
// It was not touched in the parent and we added it
parent_new.insert(new);
}
// Else it was removed in the parent and we added it again. We can forget this change
} }
parent_new.extend(statediffnew);
self.save_state_from_diff( self.save_state_from_diff(
shortstatehash, shortstatehash,
@ -557,11 +566,20 @@ impl Rooms {
for removed in statediffremoved { for removed in statediffremoved {
if !parent_new.remove(&removed) { if !parent_new.remove(&removed) {
// It was not added in the parent and we removed it
parent_removed.insert(removed); parent_removed.insert(removed);
} }
// Else it was added in the parent and we removed it again. We can forget this change
}
for new in statediffnew {
if !parent_removed.remove(&new) {
// It was not touched in the parent and we added it
parent_new.insert(new);
}
// Else it was removed in the parent and we added it again. We can forget this change
} }
parent_new.extend(statediffnew);
self.save_state_from_diff( self.save_state_from_diff(
shortstatehash, shortstatehash,
parent_new, parent_new,