diff --git a/Cargo.lock b/Cargo.lock index b04dd05..15885d2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -407,6 +407,15 @@ dependencies = [ "nodrop", ] +[[package]] +name = "async-mutex" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2158da821e7ba10beee4c01ad1d8f7f49a30675f8761106dd7d569284024d40" +dependencies = [ + "event-listener", +] + [[package]] name = "async-trait" version = "0.1.31" @@ -876,6 +885,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "event-listener" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0173b36d730a966f1e1aa2a811cc41619aaf50df92df434fdbad0504d39a973d" + [[package]] name = "failure" version = "0.1.8" @@ -1965,6 +1980,7 @@ dependencies = [ "actix-webfinger", "ammonia", "anyhow", + "async-mutex", "async-trait", "background-jobs", "base64 0.12.1", diff --git a/Cargo.toml b/Cargo.toml index 7c0ca0d..b824cef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,6 +20,7 @@ actix-webfinger = "0.3.0-alpha.6" activitystreams-new = { git = "https://git.asonix.dog/asonix/activitystreams-sketch" } activitystreams-ext = { git = "https://git.asonix.dog/asonix/activitystreams-ext" } ammonia = "3.1.0" +async-mutex = "1.0.1" async-trait = "0.1.24" background-jobs = "0.8.0-alpha.2" bytes = "0.5.4" diff --git a/src/data/media.rs b/src/data/media.rs index 587b8e3..ecc7a01 100644 --- a/src/data/media.rs +++ b/src/data/media.rs @@ -1,10 +1,11 @@ use crate::{db::Db, error::MyError}; use activitystreams_new::primitives::XsdAnyUri; +use async_mutex::Mutex; use bytes::Bytes; use futures::join; use lru::LruCache; use std::{collections::HashMap, sync::Arc, time::Duration}; -use tokio::sync::{Mutex, RwLock}; +use tokio::sync::RwLock; use ttl_cache::TtlCache; use uuid::Uuid;