From e9a7f822f1cb39c875f99011b8db55e6b2ca51b1 Mon Sep 17 00:00:00 2001 From: j-mendez Date: Tue, 26 Dec 2023 21:21:02 -0500 Subject: [PATCH] chore(lib): remove panic on add --- Cargo.lock | 8 ++++---- Cargo.toml | 5 +++-- src/lib.rs | 7 +++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e57207..e0c9b4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" dependencies = [ "proc-macro2", "quote", @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "num_cpus", diff --git a/Cargo.toml b/Cargo.toml index 449066d..b007a47 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,14 +9,15 @@ keywords = ["crawler", "spider"] categories = ["web-programming"] license = "MIT" documentation = "https://docs.rs/async_job" +authors = ["j-mendez "] [dependencies] -async-trait = "0.1.74" +async-trait = "0.1.75" chrono = "0.4.31" cron = "0.12.0" lazy_static = "1.4.0" log = "0.4.20" -tokio = { version = "^1.34.0", features = [ "macros", "time", "parking_lot" ] } +tokio = { version = "^1.35.0", features = [ "macros", "time", "parking_lot" ] } [features] default = ["rt-multi-thread"] diff --git a/src/lib.rs b/src/lib.rs index 850ba51..52f5634 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -213,13 +213,12 @@ impl Runner { /// Add jobs into the runner /// - /// **panics** if you try to push a job onto already started runner + /// Does nothing if already running. #[allow(clippy::should_implement_trait)] pub fn add(mut self, job: Box) -> Self { - if self.running { - panic!("Cannot push job onto runner once the runner is started!"); + if !self.running { + self.jobs.push(job); } - self.jobs.push(job); self }