|
@@ -6,7 +6,7 @@ use select::predicate::Name;
|
|
use std::collections::HashMap;
|
|
use std::collections::HashMap;
|
|
// extern crate url;
|
|
// extern crate url;
|
|
use url::form_urlencoded::{byte_serialize};
|
|
use url::form_urlencoded::{byte_serialize};
|
|
-
|
|
|
|
|
|
+use log::*;
|
|
|
|
|
|
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
|
#[derive(Serialize, Deserialize, Debug, Default, Clone)]
|
|
pub struct Auction {
|
|
pub struct Auction {
|
|
@@ -140,9 +140,12 @@ fn parse_price(price: &str) -> Option<f32> {
|
|
fn auction_details(auction: &Auction) -> Auction {
|
|
fn auction_details(auction: &Auction) -> Auction {
|
|
let mut updated_auction = auction.clone();
|
|
let mut updated_auction = auction.clone();
|
|
|
|
|
|
|
|
+ if auction.is_price_final {
|
|
|
|
+ return updated_auction;
|
|
|
|
+ }
|
|
|
|
|
|
let client = reqwest::Client::builder()
|
|
let client = reqwest::Client::builder()
|
|
- .timeout(Some(core::time::Duration::from_secs(8)))
|
|
|
|
|
|
+ // .timeout(Some(core::time::Duration::from_secs(10)))
|
|
.build()
|
|
.build()
|
|
.unwrap();
|
|
.unwrap();
|
|
|
|
|
|
@@ -181,10 +184,13 @@ fn auction_details(auction: &Auction) -> Auction {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
+ Err(e) => {
|
|
|
|
+ error!("Could not fetch auction details: {:?}", e);
|
|
|
|
+ // println!("Setting this price to final");
|
|
|
|
+ // updated_auction.is_price_final = true;
|
|
|
|
|
|
- Err(e) => println!("{:?}", e),
|
|
|
|
|
|
+ },
|
|
}
|
|
}
|
|
|
|
|
|
updated_auction
|
|
updated_auction
|
|
@@ -201,7 +207,7 @@ fn auctions_from_url(url: &str) -> HashMap<String, Auction> {
|
|
// dbg!(&url);
|
|
// dbg!(&url);
|
|
|
|
|
|
let client = reqwest::Client::builder()
|
|
let client = reqwest::Client::builder()
|
|
- .timeout(Some(core::time::Duration::from_secs(8)))
|
|
|
|
|
|
+ // .timeout(Some(core::time::Duration::from_secs(8)))
|
|
.build()
|
|
.build()
|
|
.unwrap();
|
|
.unwrap();
|
|
|
|
|
|
@@ -321,7 +327,7 @@ fn auctions_from_url(url: &str) -> HashMap<String, Auction> {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- Err(e) => println!("{:?}", e),
|
|
|
|
|
|
+ Err(e) => error!("Retrieve auction list {:?}", e),
|
|
}
|
|
}
|
|
|
|
|
|
// if let Ok(mut resp) = client.get(url).send() {
|
|
// if let Ok(mut resp) = client.get(url).send() {
|