fix: 修复日志页面自动滚动问题 (#382)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2025-07-09 23:34:50 +08:00
committed by GitHub
parent ce60838244
commit 74a45526f0
13 changed files with 43 additions and 35 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ use task::{http_server, video_downloader};
use tokio_util::sync::CancellationToken;
use tokio_util::task::TaskTracker;
use crate::api::MpscWriter;
use crate::api::{MAX_HISTORY_LOGS, MpscWriter};
use crate::config::{ARGS, VersionedConfig};
use crate::database::setup_database;
use crate::utils::init_logger;
@@ -79,7 +79,7 @@ fn spawn_task(
/// 初始化日志系统、打印欢迎信息,初始化数据库连接和全局配置
async fn init() -> (Arc<DatabaseConnection>, MpscWriter) {
let (tx, _rx) = tokio::sync::broadcast::channel(30);
let log_history = Arc::new(Mutex::new(VecDeque::with_capacity(20)));
let log_history = Arc::new(Mutex::new(VecDeque::with_capacity(MAX_HISTORY_LOGS + 1)));
let log_writer = MpscWriter::new(tx, log_history.clone());
init_logger(&ARGS.log_level, Some(log_writer.clone()));