about summary refs log tree commit diff
path: root/kittybox-rs/src
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-07-09 22:21:12 +0300
committerVika <vika@fireburn.ru>2023-07-17 01:53:42 +0300
commitdc7dfc61ec839175ebb51fcbaef1156fea5fdcf4 (patch)
tree83c935c793481864b79a6bd482f09b1622cba104 /kittybox-rs/src
parentb38b508366a80a2f1c163ae3623c79e883323201 (diff)
downloadkittybox-dc7dfc61ec839175ebb51fcbaef1156fea5fdcf4.tar.zst
cargo update, part 1
Diffstat (limited to 'kittybox-rs/src')
-rw-r--r--kittybox-rs/src/database/postgres/mod.rs10
-rw-r--r--kittybox-rs/src/webmentions/queue.rs10
2 files changed, 10 insertions, 10 deletions
diff --git a/kittybox-rs/src/database/postgres/mod.rs b/kittybox-rs/src/database/postgres/mod.rs
index 4ac2abe..286a965 100644
--- a/kittybox-rs/src/database/postgres/mod.rs
+++ b/kittybox-rs/src/database/postgres/mod.rs
@@ -134,7 +134,7 @@ impl Storage for PostgresStorage {
         let mut txn = self.db.begin().await?;
         let (uid, mut post) = sqlx::query_as::<_, (String, serde_json::Value)>("SELECT uid, mf2 FROM kittybox.mf2_json WHERE uid = $1 OR mf2['properties']['url'] ? $1 FOR UPDATE")
             .bind(url)
-            .fetch_optional(&mut txn)
+            .fetch_optional(&mut *txn)
             .await?
             .ok_or(StorageError::from_static(
                 ErrorKind::NotFound,
@@ -178,7 +178,7 @@ impl Storage for PostgresStorage {
         sqlx::query("UPDATE kittybox.mf2_json SET mf2 = $2 WHERE uid = $1")
             .bind(uid)
             .bind(post)
-            .execute(&mut txn)
+            .execute(&mut *txn)
             .await?;
             
         txn.commit().await.map_err(Into::into)
@@ -273,14 +273,14 @@ ORDER BY mf2 #>> '{properties,published,0}' DESC
     ) -> Result<Option<(serde_json::Value, Option<String>)>> {
         let mut txn = self.db.begin().await?;
         sqlx::query("SET TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ ONLY")
-			.execute(&mut txn)
+			.execute(&mut *txn)
 			.await?;
         tracing::debug!("Started txn: {:?}", txn);
         let mut feed = match sqlx::query_scalar::<_, serde_json::Value>("
 SELECT kittybox.hydrate_author(mf2) FROM kittybox.mf2_json WHERE uid = $1
 ")
             .bind(url)
-            .fetch_optional(&mut txn)
+            .fetch_optional(&mut *txn)
             .await?
         {
             Some(feed) => feed,
@@ -315,7 +315,7 @@ LIMIT $2"
             .bind(limit as i64)
             .bind(user)
             .bind(cursor)
-            .fetch_all(&mut txn)
+            .fetch_all(&mut *txn)
             .await
             .map(serde_json::Value::Array)?;
 
diff --git a/kittybox-rs/src/webmentions/queue.rs b/kittybox-rs/src/webmentions/queue.rs
index 0b11a4e..3ced831 100644
--- a/kittybox-rs/src/webmentions/queue.rs
+++ b/kittybox-rs/src/webmentions/queue.rs
@@ -54,13 +54,13 @@ impl<T: PostgresJobItem> Drop for PostgresJob<T> {
                     .push(" WHERE id = ")
                     .push_bind(id)
                     .build()
-                    .execute(&mut txn)
+                    .execute(&mut *txn)
                     .await
                     .unwrap();
                 sqlx::query_builder::QueryBuilder::new("NOTIFY ")
                     .push(T::NOTIFICATION_CHANNEL)
                     .build()
-                    .execute(&mut txn)
+                    .execute(&mut *txn)
                     .await
                     .unwrap();
                 txn.commit().await.unwrap();
@@ -79,7 +79,7 @@ impl<T: PostgresJobItem> PostgresJob<T> {
             .build_query_as::<(i32,)>()
             // It's safe to unwrap here, because we "take" the txn only on drop or commit,
             // where it's passed by value, not by reference.
-            .fetch_one(self.txn.as_mut().unwrap())
+            .fetch_one(self.txn.as_deref_mut().unwrap())
             .await
             .map(|(i,)| i as usize)
     }
@@ -94,7 +94,7 @@ impl Job<Webmention, PostgresJobQueue<Webmention>> for PostgresJob<Webmention> {
         tracing::debug!("Deleting {} from the job queue", self.id);
         sqlx::query("DELETE FROM kittybox.incoming_webmention_queue WHERE id = $1")
             .bind(self.id)
-            .execute(self.txn.as_mut().unwrap())
+            .execute(self.txn.as_deref_mut().unwrap())
             .await?;
 
         self.txn.take().unwrap().commit().await
@@ -149,7 +149,7 @@ impl JobQueue<Webmention> for PostgresJobQueue<Webmention> {
         match sqlx::query_as::<_, PostgresJobRow<Webmention>>(
             "SELECT id, source, target FROM kittybox.incoming_webmention_queue WHERE attempts < 5 FOR UPDATE SKIP LOCKED LIMIT 1"
         )
-            .fetch_optional(&mut txn)
+            .fetch_optional(&mut *txn)
             .await?
         {
             Some(job_row) => {