Use a better mutex

This commit is contained in:
asonix 2020-05-21 21:42:56 -05:00
parent 1dbfce9430
commit 4df92f5128
3 changed files with 19 additions and 1 deletions

16
Cargo.lock generated
View file

@ -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",

View file

@ -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"

View file

@ -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;