release: v1.3.1 - Pipeline Queue Integration, OCR Fix, Worker Compatibility
Major Changes: - Pipeline Queue integration completed (internal.file + pipeline.commands) - Fixed old job_worker database compatibility with new command_queue table - Compiled Swift OCR binary (was missing, causing empty OCR results) - Added deep scan functionality through re-scan API Fixes: - Changed CommandJob.id from i32 to i64 for database compatibility - Added UUID generation in create_command (message_id field) - Fixed claim_pending_commands to query queue_name = 'internal.file' - Fixed field mappings: command_id → message_id, job_type → command_type - Added support for 'processing' status in CommandJobStatus Queue System: - internal.file queue: for register/unregister/re-scan commands (job_worker) - pipeline.commands queue: for vectorize/store_asrx/etc commands (pipeline_worker) Documentation: - Added comprehensive queue system documentation - Created M4 workspace status reports - Updated AGENTS.md with queue system details
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
// Pipeline Worker - 独立进程,处理 command_queue 中的 Pipeline 命令
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use momentry_core::core::command::pipeline::PipelineWorker;
|
||||
use momentry_core::core::config;
|
||||
use sqlx::PgPool;
|
||||
use std::time::Duration;
|
||||
use tracing::{error, info};
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
// 初始化日志
|
||||
tracing_subscriber::registry()
|
||||
.with(
|
||||
tracing_subscriber::fmt::layer()
|
||||
.with_target(false)
|
||||
.with_thread_ids(false)
|
||||
)
|
||||
.init();
|
||||
|
||||
info!("Pipeline Worker starting...");
|
||||
|
||||
// 加载环境变量
|
||||
dotenv::dotenv().ok();
|
||||
|
||||
// 连接数据库
|
||||
let database_url = config::DATABASE_URL.clone();
|
||||
let db = PgPool::connect(&database_url)
|
||||
.await
|
||||
.context("Failed to connect to database")?;
|
||||
|
||||
info!("Connected to database");
|
||||
|
||||
// 创建 Pipeline Worker
|
||||
let worker = PipelineWorker::new(db);
|
||||
|
||||
// 启动 worker
|
||||
info!("Pipeline Worker started, polling for commands...");
|
||||
|
||||
// 主循环
|
||||
loop {
|
||||
match worker.start().await {
|
||||
Ok(_) => {
|
||||
// start() 会无限循环,除非出错
|
||||
info!("Worker loop completed unexpectedly");
|
||||
}
|
||||
Err(e) => {
|
||||
error!("Worker error: {}", e);
|
||||
error!("Restarting in 5 seconds...");
|
||||
tokio::time::sleep(Duration::from_secs(5)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user