Run event / notification handlers in separate async tasks
Prevents deadlocks when new handlers are registered from within an existing handler.
This commit is contained in:
parent
606a57203e
commit
c3e25bda1a
2 changed files with 2 additions and 2 deletions
|
@ -2123,7 +2123,7 @@ impl Client {
|
|||
};
|
||||
|
||||
for notification in room_notifications {
|
||||
(handler)(notification.clone(), room.clone(), self.clone()).await;
|
||||
tokio::spawn((handler)(notification.clone(), room.clone(), self.clone()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ impl Client {
|
|||
room: room.clone(),
|
||||
raw: event.json(),
|
||||
};
|
||||
(handler)(data).await;
|
||||
tokio::spawn((handler)(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue