set default database backend in nixos module to rocksdb

The media backend already has a default value.
This commit is contained in:
Olivia Lee 2025-04-06 20:03:09 -07:00 committed by avdb13
parent 1cd12460d7
commit cc0bde5b4d
2 changed files with 25 additions and 37 deletions

View file

@ -40,7 +40,15 @@ in
'';
default = false;
};
database.path = lib.mkOption {
database = {
backend = lib.mkOption {
type = types.nonEmptyStr;
description = ''
The database backend to use.
'';
default = "rocksdb";
};
path = lib.mkOption {
type = types.nonEmptyStr;
readOnly = true;
description = ''
@ -53,6 +61,7 @@ in
then "/var/lib/matrix-conduit/database"
else "/var/lib/grapevine/database";
};
};
media.backend = {
type = lib.mkOption {
type = types.nonEmptyStr;

View file

@ -716,7 +716,10 @@ pub(crate) fn parse_incoming_pdu(
let room_version_id = services()
.rooms
.state
.get_create_content::<ExtractVersion>(&room_id)?;
.get_create_content::<ExtractVersion>(&room_id)
.inspect_err(|_| {
debug!(%room_id, "This server is not in the room");
})?;
let Ok((event_id, value)) =
gen_event_id_canonical_json(pdu, &room_version_id)
@ -745,31 +748,7 @@ pub(crate) async fn send_transaction_message_route(
let pub_key_map = RwLock::new(BTreeMap::new());
for pdu in &body.pdus {
let value: CanonicalJsonObject = serde_json::from_str(pdu.get())
.map_err(|error| {
warn!(%error, object = ?pdu, "Error parsing incoming event");
Error::BadServerResponse("Invalid PDU in server response")
})?;
let room_id: OwnedRoomId = value
.get("room_id")
.and_then(|id| RoomId::parse(id.as_str()?).ok())
.ok_or(Error::BadRequest(
ErrorKind::InvalidParam,
"Invalid room id in pdu",
))?;
if services()
.rooms
.state
.get_create_content::<ExtractVersion>(&room_id)
.is_err()
{
debug!(%room_id, "This server is not in the room");
continue;
}
let r = parse_incoming_pdu(pdu);
let (event_id, value, room_id) = match r {
let (event_id, value, room_id) = match parse_incoming_pdu(pdu) {
Ok(t) => t,
Err(error) => {
warn!(%error, object = ?pdu, "Error parsing incoming event");