Skip to content

Commit

Permalink
chore(lib): remove panic on add
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mendez committed Dec 27, 2023
1 parent f7d589b commit e9a7f82
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ keywords = ["crawler", "spider"]
categories = ["web-programming"]
license = "MIT"
documentation = "https://docs.rs/async_job"
authors = ["j-mendez <[email protected]>"]

[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"]
Expand Down
7 changes: 3 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn Job>) -> 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
}

Expand Down

0 comments on commit e9a7f82

Please sign in to comment.