mirror of
https://git.asonix.dog/asonix/background-jobs.git
synced 2024-11-22 03:51:00 +00:00
Use a better mutex
This commit is contained in:
parent
77999cf295
commit
57761f3609
5 changed files with 13 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "background-jobs"
|
name = "background-jobs"
|
||||||
description = "Background Jobs implemented with actix and futures"
|
description = "Background Jobs implemented with actix and futures"
|
||||||
version = "0.8.0-alpha.2"
|
version = "0.8.0-alpha.3"
|
||||||
license-file = "LICENSE"
|
license-file = "LICENSE"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
||||||
|
@ -21,10 +21,10 @@ members = [
|
||||||
default = ["background-jobs-actix"]
|
default = ["background-jobs-actix"]
|
||||||
|
|
||||||
[dependencies.background-jobs-core]
|
[dependencies.background-jobs-core]
|
||||||
version = "0.8.0-alpha.0"
|
version = "0.8.0-alpha.3"
|
||||||
path = "jobs-core"
|
path = "jobs-core"
|
||||||
|
|
||||||
[dependencies.background-jobs-actix]
|
[dependencies.background-jobs-actix]
|
||||||
version = "0.8.0-alpha.1"
|
version = "0.8.0-alpha.3"
|
||||||
path = "jobs-actix"
|
path = "jobs-actix"
|
||||||
optional = true
|
optional = true
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "background-jobs-actix"
|
name = "background-jobs-actix"
|
||||||
description = "in-process jobs processor based on Actix"
|
description = "in-process jobs processor based on Actix"
|
||||||
version = "0.8.0-alpha.2"
|
version = "0.8.0-alpha.3"
|
||||||
license-file = "../LICENSE"
|
license-file = "../LICENSE"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
||||||
|
@ -12,8 +12,9 @@ edition = "2018"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = "1.1.0"
|
actix-rt = "1.1.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
async-mutex = "1.0.1"
|
||||||
async-trait = "0.1.24"
|
async-trait = "0.1.24"
|
||||||
background-jobs-core = { version = "0.8.0-alpha.0", path = "../jobs-core", features = ["with-actix"] }
|
background-jobs-core = { version = "0.8.0-alpha.3", path = "../jobs-core", features = ["with-actix"] }
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num_cpus = "1.10.0"
|
num_cpus = "1.10.0"
|
||||||
|
|
|
@ -7,6 +7,7 @@ use actix_rt::{
|
||||||
time::{interval_at, Instant},
|
time::{interval_at, Instant},
|
||||||
};
|
};
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
|
use async_mutex::Mutex;
|
||||||
use background_jobs_core::{NewJobInfo, ReturnJobInfo, Stats, Storage};
|
use background_jobs_core::{NewJobInfo, ReturnJobInfo, Stats, Storage};
|
||||||
use log::{error, trace};
|
use log::{error, trace};
|
||||||
use std::{
|
use std::{
|
||||||
|
@ -14,7 +15,6 @@ use std::{
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
use tokio::sync::Mutex;
|
|
||||||
|
|
||||||
type WorkerQueue = VecDeque<Box<dyn Worker + Send>>;
|
type WorkerQueue = VecDeque<Box<dyn Worker + Send>>;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
[package]
|
[package]
|
||||||
name = "background-jobs-core"
|
name = "background-jobs-core"
|
||||||
description = "Core types for implementing an asynchronous jobs processor"
|
description = "Core types for implementing an asynchronous jobs processor"
|
||||||
version = "0.8.0-alpha.2"
|
version = "0.8.0-alpha.3"
|
||||||
license-file = "../LICENSE"
|
license-file = "../LICENSE"
|
||||||
authors = ["asonix <asonix@asonix.dog>"]
|
authors = ["asonix <asonix@asonix.dog>"]
|
||||||
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
repository = "https://git.asonix.dog/Aardwolf/background-jobs"
|
||||||
|
@ -16,12 +16,15 @@ with-actix = ["actix-rt", "tokio"]
|
||||||
[dependencies]
|
[dependencies]
|
||||||
actix-rt = { version = "1.1.0", optional = true }
|
actix-rt = { version = "1.1.0", optional = true }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
async-mutex = "1.0.1"
|
||||||
async-trait = "0.1.24"
|
async-trait = "0.1.24"
|
||||||
chrono = { version = "0.4", features = ["serde"] }
|
chrono = { version = "0.4", features = ["serde"] }
|
||||||
futures = "0.3.4"
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "0.2.13", optional = true }
|
tokio = { version = "0.2.13", optional = true }
|
||||||
uuid = { version = "0.8.1", features = ["serde", "v4"] }
|
uuid = { version = "0.8.1", features = ["serde", "v4"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
futures = "0.3.4"
|
||||||
|
|
|
@ -135,8 +135,8 @@ pub trait Storage: Clone + Send {
|
||||||
/// A default, in-memory implementation of a storage mechanism
|
/// A default, in-memory implementation of a storage mechanism
|
||||||
pub mod memory_storage {
|
pub mod memory_storage {
|
||||||
use super::{JobInfo, Stats};
|
use super::{JobInfo, Stats};
|
||||||
|
use async_mutex::Mutex;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use futures::lock::Mutex;
|
|
||||||
use std::{collections::HashMap, convert::Infallible, sync::Arc};
|
use std::{collections::HashMap, convert::Infallible, sync::Arc};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue