fix: multiple federation/pusher fixes
This commit is contained in:
parent
21f785d530
commit
44425a903a
7 changed files with 85 additions and 167 deletions
|
@ -686,10 +686,10 @@ pub async fn get_pushers_route(
|
|||
db: State<'_, Database>,
|
||||
body: Ruma<get_pushers::Request>,
|
||||
) -> ConduitResult<get_pushers::Response> {
|
||||
let sender = body.sender_user.as_ref().expect("authenticated endpoint");
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
|
||||
Ok(get_pushers::Response {
|
||||
pushers: db.pusher.get_pusher(sender)?,
|
||||
pushers: db.pusher.get_pusher(sender_user)?,
|
||||
}
|
||||
.into())
|
||||
}
|
||||
|
@ -703,10 +703,10 @@ pub async fn set_pushers_route(
|
|||
db: State<'_, Database>,
|
||||
body: Ruma<set_pusher::Request>,
|
||||
) -> ConduitResult<set_pusher::Response> {
|
||||
let sender = body.sender_user.as_ref().expect("authenticated endpoint");
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
let pusher = body.pusher.clone();
|
||||
|
||||
db.pusher.set_pusher(sender, pusher)?;
|
||||
db.pusher.set_pusher(sender_user, pusher)?;
|
||||
|
||||
db.flush().await?;
|
||||
|
||||
|
|
|
@ -315,7 +315,7 @@ pub async fn sync_events_route(
|
|||
(None, None, Vec::new())
|
||||
};
|
||||
|
||||
let state_events = if dbg!(joined_since_last_sync) {
|
||||
let state_events = if joined_since_last_sync {
|
||||
current_state
|
||||
.into_iter()
|
||||
.map(|(_, pdu)| pdu.to_sync_state_event())
|
||||
|
@ -703,12 +703,7 @@ pub async fn sync_events_route(
|
|||
if duration.as_secs() > 30 {
|
||||
duration = Duration::from_secs(30);
|
||||
}
|
||||
let delay = tokio::time::sleep(duration);
|
||||
tokio::pin!(delay);
|
||||
tokio::select! {
|
||||
_ = &mut delay, if delay.is_elapsed() => {}
|
||||
_ = watcher => {}
|
||||
}
|
||||
let _ = tokio::time::timeout(duration, watcher).await;
|
||||
}
|
||||
|
||||
Ok(response.into())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue