Skip to content

Commit

Permalink
wip: don't push
Browse files Browse the repository at this point in the history
  • Loading branch information
Roardom committed Nov 11, 2024
1 parent 0ca5c39 commit d9d1af9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tracker/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::net::IpAddr;
use std::ops::{Deref, DerefMut};

use chrono::naive::serde::ts_seconds_option;
use chrono::NaiveDateTime;
use chrono::{NaiveDateTime, Utc};
use diesel::deserialize::Queryable;
use diesel::Selectable;
use indexmap::IndexMap;
Expand Down Expand Up @@ -90,13 +90,18 @@ impl Map {
use crate::schema::peers;
use diesel::prelude::*;
use diesel_async::RunQueryDsl;
let now = Utc::now();

let peers_data = peers::table
.select((Index::as_select(), Peer::as_select()))
.load(&mut db.get().await?)
.await
.context("Failed loading peers.")?;

println!(
"\n\nPeers loaded in {} seconds.\n\n",
Utc::now().signed_duration_since(now).num_milliseconds() as f64 / 1000.0
);
Ok(peers_data)
}
}
Expand Down

0 comments on commit d9d1af9

Please sign in to comment.