add configuration for the stdout pixel-changed interval

This commit is contained in:
Noa Aarts 2024-12-10 22:38:14 +01:00
parent 8969a9e6d5
commit 62d6dd76d3
Signed by: noa
GPG key ID: 1850932741EFF672
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);