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