Commit 49269a2551

49269a25513c6a92bec9b996aa10765c60fd4cdb

parent: ed6b8ef573

Unsigned

Damir Jelić <poljar@termina.org.uk> · 2021-02-03 17:26 UTC

room: Allow holding the typing lock across an await point

Layout: unified · split

src/room/mod.rs +4 −1
@@ -676,11 +676,14 @@ impl MatrixRoom {
676676 let room_id = self.room_id.clone();
677677 let typing_notice_time = self.typing_notice_time.clone();
678678
679 #[allow(clippy::await_holding_lock)]
679680 let send = |typing: bool| async move {
680681 let typing_time = typing_notice_time;
681682
682683 // We're in the process of sending out a typing notice, so don't
683 // make the same request twice.
684 // make the same request twice. It's fine to hold on to this lock
685 // accross the await point since we're not going to try to lock it
686 // anywhere else.
684687 let guard = match typing_in_flight.try_lock() {
685688 Ok(guard) => guard,
686689 Err(_) => {