|
@@ -225,19 +225,32 @@ fn daemon(queries: Vec<Query>, loaded_auctions: Vec<Auction>) {
|
|
|
|
|
|
|
|
// dbg!(&queries);
|
|
// dbg!(&queries);
|
|
|
// let _s = loaded_auctions.into_iter().map(|x| (x.url.clone(), x.clone())).collect::<Vec<_>>();
|
|
// let _s = loaded_auctions.into_iter().map(|x| (x.url.clone(), x.clone())).collect::<Vec<_>>();
|
|
|
- let mut auction_map: HashMap<String, Auction> = loaded_auctions.into_iter().map(|x| (x.url.clone(), x.clone())).collect();
|
|
|
|
|
-
|
|
|
|
|
- for (_key, mut auction) in auction_map {
|
|
|
|
|
- if Utc::now().with_timezone(&Local).timestamp() > auction.timestamp {
|
|
|
|
|
- //auction has expired, mark price as final
|
|
|
|
|
- auction.is_price_final = true;
|
|
|
|
|
- dbg!(&auction);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ // for auction in loaded_auctions {
|
|
|
|
|
+ // if Utc::now().with_timezone(&Local).timestamp() > auction.timestamp {
|
|
|
|
|
+ // //auction has expired, mark price as final
|
|
|
|
|
+ // auction.is_price_final = true;
|
|
|
|
|
+ // // let a = auction_map.get_mut(_key);
|
|
|
|
|
+ // dbg!(&auction);
|
|
|
|
|
+ // }
|
|
|
|
|
+ // }
|
|
|
|
|
+
|
|
|
|
|
+ let auction_map: HashMap<String, Auction> = loaded_auctions
|
|
|
|
|
+ .into_iter()
|
|
|
|
|
+ .map(|mut x| {
|
|
|
|
|
+ if Utc::now().with_timezone(&Local).timestamp() > x.timestamp {
|
|
|
|
|
+ // auction has expired, mark price as final
|
|
|
|
|
+ x.is_price_final = true;
|
|
|
|
|
+ }
|
|
|
|
|
+ x
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
|
|
+ .map(|x| (x.url.clone(), x.clone()))
|
|
|
|
|
+ .collect();
|
|
|
|
|
+
|
|
|
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ // return;
|
|
|
println!("Starting daemon with {} active queries", queries.len());
|
|
println!("Starting daemon with {} active queries", queries.len());
|
|
|
loop {
|
|
loop {
|
|
|
// TODO: see if we can get rid of clone
|
|
// TODO: see if we can get rid of clone
|