From 62d6dd76d36ed29cfbe159a6e271e38504fee443 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Tue, 10 Dec 2024 22:38:14 +0100 Subject: [PATCH] add configuration for the stdout pixel-changed interval --- src/config.rs | 1 + src/main.rs | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 3318dea..230f9f6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,6 +6,7 @@ pub const WEB_HOST: &str = "127.0.0.1:3000"; pub const IMAGE_SAVE_INTERVAL: Duration = Duration::from_secs(5); pub const JPEG_UPDATE_INTERVAL: Duration = Duration::from_millis(17); pub const WEB_UPDATE_INTERVAL: Duration = Duration::from_millis(50); +pub const STDOUT_STATISTICS_INTERVAL: Duration = Duration::from_millis(5000); pub const HELP_TEXT: &[u8] = b"Flurry is a pixelflut implementation, this means you can use commands to get and set pixels in the canvas SIZE returns the size of the canvas diff --git a/src/main.rs b/src/main.rs index 3581e50..f07ee47 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,9 @@ use std::{ use chrono::Local; use flurry::{ - config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL}, + config::{ + GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL, STDOUT_STATISTICS_INTERVAL, + }, flutclient::{FlutClient, ParserTypes}, grid::{self, Flut}, webapi::WebApiContext, @@ -21,7 +23,7 @@ use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _ /// This function logs the current amount of changed pixels to stdout every second async fn pixel_change_stdout_log() -> AsyncResult { - let mut interval = tokio::time::interval(Duration::from_millis(1000)); + let mut interval = tokio::time::interval(STDOUT_STATISTICS_INTERVAL); loop { interval.tick().await; let cnt = COUNTER.load(std::sync::atomic::Ordering::Relaxed);