Skip to content

Commit

Permalink
Change Date format
Browse files Browse the repository at this point in the history
  • Loading branch information
raimannma committed Oct 10, 2024
1 parent d15921d commit ab18255
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions active-matches-scraper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async fn compress_temp_file() -> Result<Vec<u8>, io::Error> {
struct ActiveMatch {
match_id: u32,
#[serde(default = "scraped_at")]
scraped_at: i32,
scraped_at: u32,
winning_team: u8,
start_time: u32,
players: Vec<ActiveMatchPlayer>,
Expand All @@ -171,11 +171,11 @@ struct ActiveMatchPlayer {
hero_id: u32,
}

fn scraped_at() -> i32 {
fn scraped_at() -> u32 {
SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.unwrap()
.as_secs() as i32
.as_secs() as u32
}

async fn fetch_active_matches() -> reqwest::Result<Vec<ActiveMatch>> {
Expand Down
2 changes: 1 addition & 1 deletion clickhouse/migrations/03_create_active_matches_table.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE IF NOT EXISTS active_matches
(
match_id UInt32,
scraped_at DateTime64,
scraped_at DATETIME,
start_time DATETIME,
winning_team UInt8,
players Nested (
Expand Down
2 changes: 1 addition & 1 deletion db-ingest/src/models/active_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
#[derive(Debug, Deserialize, Serialize, Clone)]
pub struct ActiveMatch {
pub match_id: u32,
pub scraped_at: i64,
pub scraped_at: u32,
pub winning_team: u8,
pub start_time: u32,
pub players: Vec<ActiveMatchPlayer>,
Expand Down
2 changes: 1 addition & 1 deletion db-ingest/src/models/clickhouse_active_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::Serialize;
#[derive(Row, Serialize, Debug)]
pub struct ClickHouseActiveMatch {
pub match_id: u32,
pub scraped_at: i64,
pub scraped_at: u32,
pub start_time: u32,
pub winning_team: u8,
#[serde(rename = "players.account_id")]
Expand Down

0 comments on commit ab18255

Please sign in to comment.