Fix branches sharing code

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-09 05:15:27 +00:00
parent b65f05ce19
commit 67f4285504
4 changed files with 6 additions and 13 deletions

View file

@ -715,7 +715,6 @@ correctness = "warn"
nursery = "warn" nursery = "warn"
## some sadness ## some sadness
branches_sharing_code = { level = "allow", priority = 1 } # TODO
derive_partial_eq_without_eq = { level = "allow", priority = 1 } # TODO derive_partial_eq_without_eq = { level = "allow", priority = 1 } # TODO
equatable_if_let = { level = "allow", priority = 1 } # TODO equatable_if_let = { level = "allow", priority = 1 } # TODO
future_not_send = { level = "allow", priority = 1 } # TODO future_not_send = { level = "allow", priority = 1 } # TODO

View file

@ -182,7 +182,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
let options = BackupEngineOptions::new(path.unwrap())?; let options = BackupEngineOptions::new(path.unwrap())?;
let mut engine = BackupEngine::open(&options, &self.env)?; let mut engine = BackupEngine::open(&options, &self.env)?;
let ret = if self.config.database_backups_to_keep > 0 { if self.config.database_backups_to_keep > 0 {
if let Err(e) = engine.create_new_backup_flush(&self.rocks, true) { if let Err(e) = engine.create_new_backup_flush(&self.rocks, true) {
return Err(Box::new(e)); return Err(Box::new(e));
} }
@ -193,10 +193,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
"Created database backup #{} using {} bytes in {} files", "Created database backup #{} using {} bytes in {} files",
info.backup_id, info.size, info.num_files, info.backup_id, info.size, info.num_files,
); );
Ok(()) }
} else {
Ok(())
};
if self.config.database_backups_to_keep >= 0 { if self.config.database_backups_to_keep >= 0 {
let keep = u32::try_from(self.config.database_backups_to_keep)?; let keep = u32::try_from(self.config.database_backups_to_keep)?;
@ -205,7 +202,7 @@ impl KeyValueDatabaseEngine for Arc<Engine> {
} }
} }
ret Ok(())
} }
fn backup_list(&self) -> Result<String> { fn backup_list(&self) -> Result<String> {

View file

@ -529,10 +529,8 @@ impl Service {
&room_id, &room_id,
&state_lock, &state_lock,
).await?; ).await?;
Ok(())
} else {
Ok(())
} }
Ok(())
} }
} }

View file

@ -91,11 +91,10 @@ impl Service {
let mut users = Vec::new(); let mut users = Vec::new();
if let Some(userids) = self.db.get_participants(root_id)? { if let Some(userids) = self.db.get_participants(root_id)? {
users.extend_from_slice(&userids); users.extend_from_slice(&userids);
users.push(pdu.sender.clone());
} else { } else {
users.push(root_pdu.sender); users.push(root_pdu.sender);
users.push(pdu.sender.clone());
} }
users.push(pdu.sender.clone());
self.db.update_participants(root_id, &users) self.db.update_participants(root_id, &users)
} }