strip away the stdout counter

This commit is contained in:
Noa Aarts 2024-12-11 21:18:13 +01:00
parent 5c3690d72a
commit 1db13c89c6
Signed by: noa
GPG key ID: 1850932741EFF672
2 changed files with 2 additions and 17 deletions

View file

@ -6,7 +6,6 @@ pub const WEB_HOST: &str = "127.0.0.1:3000";
pub const IMAGE_SAVE_INTERVAL: Duration = Duration::from_secs(5); pub const IMAGE_SAVE_INTERVAL: Duration = Duration::from_secs(5);
pub const JPEG_UPDATE_INTERVAL: Duration = Duration::from_millis(17); pub const JPEG_UPDATE_INTERVAL: Duration = Duration::from_millis(17);
pub const WEB_UPDATE_INTERVAL: Duration = Duration::from_millis(50); 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 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 SIZE returns the size of the canvas

View file

@ -8,28 +8,16 @@ use std::{
}; };
use flurry::{ use flurry::{
config::{ config::{GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL},
GRID_LENGTH, HOST, IMAGE_SAVE_INTERVAL, JPEG_UPDATE_INTERVAL, STDOUT_STATISTICS_INTERVAL,
},
flutclient::{FlutClient, ParserTypes}, flutclient::{FlutClient, ParserTypes},
grid::{self, Flut}, grid::{self, Flut},
webapi::WebApiContext, webapi::WebApiContext,
AsyncResult, COUNTER, AsyncResult,
}; };
use futures::never::Never; use futures::never::Never;
use tokio::{net::TcpListener, time::interval, try_join}; use tokio::{net::TcpListener, time::interval, try_join};
use tracing_subscriber::{layer::SubscriberExt as _, util::SubscriberInitExt as _}; 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(STDOUT_STATISTICS_INTERVAL);
loop {
interval.tick().await;
let cnt = COUNTER.load(std::sync::atomic::Ordering::Relaxed);
tracing::info!("{cnt} pixels changed");
}
}
/// This function starts a timer that saves the current grid state every `duration`. /// This function starts a timer that saves the current grid state every `duration`.
/// These images may then be used for moderation or timelapses /// These images may then be used for moderation or timelapses
/// ///
@ -116,7 +104,6 @@ async fn main() {
}; };
tracing::info!("Started TCP listener on {HOST}"); tracing::info!("Started TCP listener on {HOST}");
let pixel_logger = tokio::spawn(pixel_change_stdout_log());
let snapshots = tokio::spawn(save_image_frames(grids.clone(), IMAGE_SAVE_INTERVAL)); let snapshots = tokio::spawn(save_image_frames(grids.clone(), IMAGE_SAVE_INTERVAL));
let pixelflut_server = tokio::spawn(handle_flut(flut_listener, grids.clone())); let pixelflut_server = tokio::spawn(handle_flut(flut_listener, grids.clone()));
let jpeg_update_loop = tokio::spawn(jpeg_update_loop(grids.clone())); let jpeg_update_loop = tokio::spawn(jpeg_update_loop(grids.clone()));
@ -125,7 +112,6 @@ async fn main() {
})); }));
let res = try_join! { let res = try_join! {
pixel_logger,
snapshots, snapshots,
pixelflut_server, pixelflut_server,
jpeg_update_loop, jpeg_update_loop,