fix: sending slowness
This commit is contained in:
parent
0b263208e3
commit
b7ab57897b
15 changed files with 574 additions and 417 deletions
|
@ -49,25 +49,29 @@ pub async fn send_message_event_route(
|
|||
let mut unsigned = serde_json::Map::new();
|
||||
unsigned.insert("transaction_id".to_owned(), body.txn_id.clone().into());
|
||||
|
||||
let event_id = db.rooms.build_and_append_pdu(
|
||||
PduBuilder {
|
||||
event_type: body.content.event_type().into(),
|
||||
content: serde_json::from_str(
|
||||
body.json_body
|
||||
.as_ref()
|
||||
.ok_or(Error::BadRequest(ErrorKind::BadJson, "Invalid JSON body."))?
|
||||
.get(),
|
||||
)
|
||||
.map_err(|_| Error::BadRequest(ErrorKind::BadJson, "Invalid JSON body."))?,
|
||||
unsigned: Some(unsigned),
|
||||
state_key: None,
|
||||
redacts: None,
|
||||
},
|
||||
&sender_id,
|
||||
&body.room_id,
|
||||
&db.globals,
|
||||
&db.account_data,
|
||||
).await?;
|
||||
let event_id = db
|
||||
.rooms
|
||||
.build_and_append_pdu(
|
||||
PduBuilder {
|
||||
event_type: body.content.event_type().into(),
|
||||
content: serde_json::from_str(
|
||||
body.json_body
|
||||
.as_ref()
|
||||
.ok_or(Error::BadRequest(ErrorKind::BadJson, "Invalid JSON body."))?
|
||||
.get(),
|
||||
)
|
||||
.map_err(|_| Error::BadRequest(ErrorKind::BadJson, "Invalid JSON body."))?,
|
||||
unsigned: Some(unsigned),
|
||||
state_key: None,
|
||||
redacts: None,
|
||||
},
|
||||
&sender_id,
|
||||
&body.room_id,
|
||||
&db.globals,
|
||||
&db.sending,
|
||||
&db.account_data,
|
||||
)
|
||||
.await?;
|
||||
|
||||
db.transaction_ids
|
||||
.add_txnid(sender_id, device_id, &body.txn_id, event_id.as_bytes())?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue