Skip to content

Commit

Permalink
tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
andymck committed Jul 27, 2023
1 parent 6e15098 commit cef6f7e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions mobile_verifier/migrations/15_speedtests_one_to_one.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

CREATE TABLE speedtests_migration (
id TEXT NOT NULL,
pubkey text NOT NULL,
upload_speed bigint,
download_speed bigint,
latency integer,
timestamp TIMESTAMP NOT NULL
timestamp timestamptz NOT NULL
);

insert into speedtests_migration (id, upload_speed, download_speed, latency, timestamp)
insert into speedtests_migration (pubkey, upload_speed, download_speed, latency, timestamp)
select id, (st).upload_speed, (st).download_speed, (st).latency, (st).timestamp
from (select id, unnest(speedtests) as st from speedtests) as tmp;

Expand Down
6 changes: 5 additions & 1 deletion mobile_verifier/src/speedtests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ pub type EpochSpeedTests = HashMap<PublicKeyBinary, Vec<Speedtest>>;
#[sqlx(type_name = "speedtest")]
pub struct Speedtest {
pub pubkey: PublicKeyBinary,
pub timestamp: DateTime<Utc>,
pub upload_speed: i64,
pub download_speed: i64,
pub latency: i32,
pub timestamp: DateTime<Utc>,
}

impl Speedtest {
Expand Down Expand Up @@ -89,6 +89,10 @@ impl SpeedtestDaemon {
&self,
file_info_stream: FileInfoStream<CellSpeedtestIngestReport>,
) -> anyhow::Result<()> {
tracing::info!(
"Processing speedtest file {}",
file_info_stream.file_info.key
);
let mut transaction = self.pool.begin().await?;
// process the speedtest reports from the file, if valid insert to the db
// collect a list of pubkeys from valid reports
Expand Down

0 comments on commit cef6f7e

Please sign in to comment.