add configuration for the stdout pixel-changed interval (#59)

Add an option in `config.rs` to set the interval to log changed pixels
to console
This commit is contained in:
Noa Aarts 2024-12-11 20:06:45 +01:00 committed by GitHub
commit d279051da7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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<Never> {
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);