Run event / notification handlers in separate async tasks

Prevents deadlocks when new handlers are registered from within an
existing handler.
master
Jonas Platte 2021-09-08 20:32:06 +02:00
parent 606a57203e
commit c3e25bda1a
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
2 changed files with 2 additions and 2 deletions

View File

@ -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()));
}
}
}

View File

@ -300,7 +300,7 @@ impl Client {
room: room.clone(),
raw: event.json(),
};
(handler)(data).await;
tokio::spawn((handler)(data));
}
}
}