Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
warittornc committed Feb 16, 2024
1 parent a702fc4 commit fc03cde
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions bothan-coin-gecko/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,12 @@ async fn process_market_data(market: &Market, cache: &Arc<Cache<PriceData>>) {
}

fn parse_market(market: &Market) -> Result<PriceData, Error> {
let naive_date_time =
NaiveDateTime::parse_from_str(market.last_updated.as_str(), "%Y-%m-%dT%H:%M:%S.%fZ")
.map_err(|_| Error::InvalidTimestamp)?;
let last_updated = market.last_updated.as_str();
let naive_date_time = NaiveDateTime::parse_from_str(last_updated, "%Y-%m-%dT%H:%M:%S.%fZ")
.map_err(|_| Error::InvalidTimestamp)?;
let timestamp =
u64::try_from(naive_date_time.timestamp()).map_err(|_| Error::InvalidTimestamp)?;

Ok(PriceData::new(
market.id.clone(),
market.current_price.to_string(),
Expand Down

0 comments on commit fc03cde

Please sign in to comment.