Use driver url from configuration
This commit is contained in:
parent
6c0e022f7a
commit
053910c03f
|
@ -1,6 +1,5 @@
|
|||
use std::cmp::Ordering;
|
||||
use std::env;
|
||||
use std::str::FromStr;
|
||||
use std::thread;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
@ -58,7 +57,6 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
let driver = "http://localhost:4444";
|
||||
let mut jobs = Vec::new();
|
||||
let some_job = Job {
|
||||
url: "https://www.rust-lang.org",
|
||||
|
@ -130,8 +128,10 @@ fn main() {
|
|||
for tj in jobs.iter_mut() {
|
||||
let should_run_by_time = tj.job.last_run.is_some() && Instant::now().duration_since(tj.job.last_run.unwrap()).ge(&tj.job.every);
|
||||
if tj.handle.is_none() && (should_run_by_time || tj.job.last_run.is_none()) {
|
||||
tj.handle = Some(thread::spawn(|| {
|
||||
return get_source(driver, tj.job.url);
|
||||
let driver = conf.driver_url.clone();
|
||||
let url = tj.job.url.clone();
|
||||
tj.handle = Some(thread::spawn(move || {
|
||||
return get_source(driver.as_str(), url);
|
||||
}));
|
||||
println!("Started thread for '{}'", tj.job.url);
|
||||
tj.job.last_run = Some(Instant::now());
|
||||
|
|
Loading…
Reference in New Issue