fix clippy warnings
This commit is contained in:
parent
1f00098687
commit
b92af896d4
|
@ -85,7 +85,7 @@ impl Executor {
|
||||||
|
|
||||||
pub fn sleep(&mut self) {
|
pub fn sleep(&mut self) {
|
||||||
if self.sleep_period < self.max_sleep_period {
|
if self.sleep_period < self.max_sleep_period {
|
||||||
self.sleep_period = self.sleep_period + self.sleep_step;
|
self.sleep_period += self.sleep_step;
|
||||||
}
|
}
|
||||||
|
|
||||||
thread::sleep(Duration::from_secs(self.sleep_period));
|
thread::sleep(Duration::from_secs(self.sleep_period));
|
||||||
|
|
|
@ -37,15 +37,11 @@ impl Postgres {
|
||||||
|
|
||||||
let url = match database_url {
|
let url = match database_url {
|
||||||
Some(string_url) => string_url,
|
Some(string_url) => string_url,
|
||||||
None => {
|
None => env::var("DATABASE_URL").expect("DATABASE_URL must be set"),
|
||||||
let url = env::var("DATABASE_URL").expect("DATABASE_URL must be set");
|
|
||||||
|
|
||||||
url
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let connection =
|
let connection =
|
||||||
PgConnection::establish(&url).expect(&format!("Error connecting to {}", url));
|
PgConnection::establish(&url).unwrap_or_else(|_| panic!("Error connecting to {}", url));
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
connection,
|
connection,
|
||||||
|
@ -85,7 +81,7 @@ impl Postgres {
|
||||||
self.connection.transaction::<Option<Task>, Error, _>(|| {
|
self.connection.transaction::<Option<Task>, Error, _>(|| {
|
||||||
let found_task = self.fetch_task();
|
let found_task = self.fetch_task();
|
||||||
|
|
||||||
if let None = found_task {
|
if found_task.is_none() {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ impl WorkerThread {
|
||||||
|
|
||||||
pub fn spawn_in_pool(name: String, restarts: u64) {
|
pub fn spawn_in_pool(name: String, restarts: u64) {
|
||||||
let mut builder = thread::Builder::new().name(name.clone());
|
let mut builder = thread::Builder::new().name(name.clone());
|
||||||
builder = builder;
|
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"starting a worker thread {}, number of restarts {}",
|
"starting a worker thread {}, number of restarts {}",
|
||||||
|
|
Loading…
Reference in a new issue