Switch to using weak transactions for queries happening on connection (#32411)
Release Notes: - N/A Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
0b7583bae5
commit
c4fd9e1a6b
3 changed files with 7 additions and 5 deletions
|
@ -501,7 +501,9 @@ impl Database {
|
||||||
|
|
||||||
/// Returns all channels for the user with the given ID.
|
/// Returns all channels for the user with the given ID.
|
||||||
pub async fn get_channels_for_user(&self, user_id: UserId) -> Result<ChannelsForUser> {
|
pub async fn get_channels_for_user(&self, user_id: UserId) -> Result<ChannelsForUser> {
|
||||||
self.transaction(|tx| async move { self.get_user_channels(user_id, None, true, &tx).await })
|
self.weak_transaction(
|
||||||
|
|tx| async move { self.get_user_channels(user_id, None, true, &tx).await },
|
||||||
|
)
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ impl Database {
|
||||||
user_b_busy: bool,
|
user_b_busy: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.transaction(|tx| async move {
|
self.weak_transaction(|tx| async move {
|
||||||
let user_a_participant = Alias::new("user_a_participant");
|
let user_a_participant = Alias::new("user_a_participant");
|
||||||
let user_b_participant = Alias::new("user_b_participant");
|
let user_b_participant = Alias::new("user_b_participant");
|
||||||
let mut db_contacts = contact::Entity::find()
|
let mut db_contacts = contact::Entity::find()
|
||||||
|
@ -91,7 +91,7 @@ impl Database {
|
||||||
|
|
||||||
/// Returns whether the given user is a busy (on a call).
|
/// Returns whether the given user is a busy (on a call).
|
||||||
pub async fn is_user_busy(&self, user_id: UserId) -> Result<bool> {
|
pub async fn is_user_busy(&self, user_id: UserId) -> Result<bool> {
|
||||||
self.transaction(|tx| async move {
|
self.weak_transaction(|tx| async move {
|
||||||
let participant = room_participant::Entity::find()
|
let participant = room_participant::Entity::find()
|
||||||
.filter(room_participant::Column::UserId.eq(user_id))
|
.filter(room_participant::Column::UserId.eq(user_id))
|
||||||
.one(&*tx)
|
.one(&*tx)
|
||||||
|
|
|
@ -80,7 +80,7 @@ impl Database {
|
||||||
&self,
|
&self,
|
||||||
user_id: UserId,
|
user_id: UserId,
|
||||||
) -> Result<Option<proto::IncomingCall>> {
|
) -> Result<Option<proto::IncomingCall>> {
|
||||||
self.transaction(|tx| async move {
|
self.weak_transaction(|tx| async move {
|
||||||
let pending_participant = room_participant::Entity::find()
|
let pending_participant = room_participant::Entity::find()
|
||||||
.filter(
|
.filter(
|
||||||
room_participant::Column::UserId
|
room_participant::Column::UserId
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue