mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2026-02-04 15:51:23 +01:00
service/sending: tiny refactors, NFC
This commit is contained in:
parent
d9c7fbbd82
commit
81c5f09919
1 changed files with 21 additions and 6 deletions
|
|
@ -576,12 +576,17 @@ impl Service {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let destination = Destination::Push(user.to_owned(), pushkey);
|
let destination = Destination::Push(user.to_owned(), pushkey);
|
||||||
let event_type = SendingEventType::Pdu(pdu_id.to_owned());
|
let event_type = SendingEventType::Pdu(pdu_id.to_owned());
|
||||||
let keys = self.db.queue_requests(&[(&destination, &event_type)])?;
|
let key = self
|
||||||
|
.db
|
||||||
|
.queue_requests(&[(&destination, &event_type)])?
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.unwrap();
|
||||||
self.sender
|
self.sender
|
||||||
.send(RequestData {
|
.send(RequestData {
|
||||||
destination,
|
destination,
|
||||||
event_type,
|
event_type,
|
||||||
key: keys.into_iter().next().unwrap(),
|
key,
|
||||||
requester_span: Span::current(),
|
requester_span: Span::current(),
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -630,12 +635,17 @@ impl Service {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let destination = Destination::Normal(server.to_owned());
|
let destination = Destination::Normal(server.to_owned());
|
||||||
let event_type = SendingEventType::Edu(serialized);
|
let event_type = SendingEventType::Edu(serialized);
|
||||||
let keys = self.db.queue_requests(&[(&destination, &event_type)])?;
|
let key = self
|
||||||
|
.db
|
||||||
|
.queue_requests(&[(&destination, &event_type)])?
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.unwrap();
|
||||||
self.sender
|
self.sender
|
||||||
.send(RequestData {
|
.send(RequestData {
|
||||||
destination,
|
destination,
|
||||||
event_type,
|
event_type,
|
||||||
key: keys.into_iter().next().unwrap(),
|
key,
|
||||||
requester_span: Span::current(),
|
requester_span: Span::current(),
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
@ -651,12 +661,17 @@ impl Service {
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let destination = Destination::Appservice(appservice_id);
|
let destination = Destination::Appservice(appservice_id);
|
||||||
let event_type = SendingEventType::Pdu(pdu_id);
|
let event_type = SendingEventType::Pdu(pdu_id);
|
||||||
let keys = self.db.queue_requests(&[(&destination, &event_type)])?;
|
let key = self
|
||||||
|
.db
|
||||||
|
.queue_requests(&[(&destination, &event_type)])?
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.unwrap();
|
||||||
self.sender
|
self.sender
|
||||||
.send(RequestData {
|
.send(RequestData {
|
||||||
destination,
|
destination,
|
||||||
event_type,
|
event_type,
|
||||||
key: keys.into_iter().next().unwrap(),
|
key,
|
||||||
requester_span: Span::current(),
|
requester_span: Span::current(),
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue