Run event / notification handlers in separate async tasks
Prevents deadlocks when new handlers are registered from within an existing handler.master
parent
606a57203e
commit
c3e25bda1a
|
@ -2123,7 +2123,7 @@ impl Client {
|
||||||
};
|
};
|
||||||
|
|
||||||
for notification in room_notifications {
|
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(),
|
room: room.clone(),
|
||||||
raw: event.json(),
|
raw: event.json(),
|
||||||
};
|
};
|
||||||
(handler)(data).await;
|
tokio::spawn((handler)(data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue