Skip to content

Commit

Permalink
active-matches: Put MATCHES_PER_FILE as env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
raimannma committed Oct 10, 2024
1 parent 612a63d commit 0449d6c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions active-matches-scraper/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ services:
env_file: ../.env
environment:
CACHE_FOLDER: /tmp
MATCHES_PER_FILE: 10000
volumes:
- tmp:/tmp
networks:
Expand Down
5 changes: 3 additions & 2 deletions active-matches-scraper/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use tokio::time::sleep;
mod rmq;
mod s3;

const MATCHES_PER_FILE: usize = 10_000;
static MATCHES_PER_FILE: LazyLock<usize> =
LazyLock::new(|| std::env::var("MATCHES_PER_FILE").unwrap().parse().unwrap());

static CACHE_FOLDER: LazyLock<String> =
LazyLock::new(|| std::env::var("CACHE_FOLDER").unwrap_or("./tmp".to_string()));
Expand All @@ -35,7 +36,7 @@ async fn main() {

let mut file_writer;
loop {
while match_count < MATCHES_PER_FILE {
while match_count < *MATCHES_PER_FILE {
let start = std::time::Instant::now();
file_writer = match OpenOptions::new()
.write(true)
Expand Down

0 comments on commit 0449d6c

Please sign in to comment.