mirror of
https://github.com/Diggsey/sqlxmq.git
synced 2024-11-21 15:51:00 +00:00
Bump version and fix clippy warning
This commit is contained in:
parent
5e4f160d91
commit
c1d7ad4a2f
4 changed files with 13 additions and 7 deletions
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
@ -1,4 +1,7 @@
|
|||
{
|
||||
"rust-analyzer.checkOnSave.allFeatures": false,
|
||||
"rust-analyzer.cargo.allFeatures": false
|
||||
"rust-analyzer.cargo.allFeatures": false,
|
||||
"rust-analyzer.cargo.features": [
|
||||
"runtime-tokio-native-tls"
|
||||
]
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sqlxmq"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
@ -23,7 +23,7 @@ uuid = { version = "1.1.2", features = ["v4"] }
|
|||
log = "0.4.14"
|
||||
serde_json = "1.0.64"
|
||||
serde = "1.0.124"
|
||||
sqlxmq_macros = { version = "0.4.1", path = "sqlxmq_macros" }
|
||||
sqlxmq_macros = { version = "0.5.0", path = "sqlxmq_macros" }
|
||||
anymap2 = "0.13.0"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "sqlxmq_macros"
|
||||
version = "0.4.1"
|
||||
version = "0.5.0"
|
||||
authors = ["Diggory Blake <diggsey@googlemail.com>"]
|
||||
edition = "2018"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
|
|
@ -15,10 +15,13 @@ use crate::hidden::{BuildFn, RunFn};
|
|||
use crate::utils::Opaque;
|
||||
use crate::{JobBuilder, JobRunnerOptions};
|
||||
|
||||
type BoxedError = Box<dyn Error + Send + 'static>;
|
||||
|
||||
/// Stores a mapping from job name to job. Can be used to construct
|
||||
/// a job runner.
|
||||
pub struct JobRegistry {
|
||||
error_handler: Arc<dyn Fn(&str, Box<dyn Error + Send + 'static>) + Send + Sync>,
|
||||
#[allow(clippy::type_complexity)]
|
||||
error_handler: Arc<dyn Fn(&str, BoxedError) + Send + Sync>,
|
||||
job_map: HashMap<&'static str, &'static NamedJob>,
|
||||
context: Map<dyn CloneAnySendSync + Send + Sync>,
|
||||
}
|
||||
|
@ -53,7 +56,7 @@ impl JobRegistry {
|
|||
/// Set a function to be called whenever a job returns an error.
|
||||
pub fn set_error_handler(
|
||||
&mut self,
|
||||
error_handler: impl Fn(&str, Box<dyn Error + Send + 'static>) + Send + Sync + 'static,
|
||||
error_handler: impl Fn(&str, BoxedError) + Send + Sync + 'static,
|
||||
) -> &mut Self {
|
||||
self.error_handler = Arc::new(error_handler);
|
||||
self
|
||||
|
@ -83,7 +86,7 @@ impl JobRegistry {
|
|||
}
|
||||
|
||||
/// The default error handler implementation, which simply logs the error.
|
||||
pub fn default_error_handler(name: &str, error: Box<dyn Error + Send + 'static>) {
|
||||
pub fn default_error_handler(name: &str, error: BoxedError) {
|
||||
log::error!("Job `{}` failed: {}", name, error);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue