release: v1.3.5 - merge Phase 1 (health/queue API + timeout_at self-heal) onto v1.3.4 base
- Add /api/v1/health/queue queue-health endpoint (public, like /health/detailed) - Add timeout_at column + index (migration 20261012_add_command_timeout.sql) - consume() stamps timeout_at; pipeline_worker self-heals timed-out commands every 5m - Bump version 1.3.4 -> 1.3.5
This commit is contained in:
Generated
+1
-1
@@ -2443,7 +2443,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "momentry_core"
|
name = "momentry_core"
|
||||||
version = "1.3.4"
|
version = "1.3.5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "momentry_core"
|
name = "momentry_core"
|
||||||
version = "1.3.4"
|
version = "1.3.5"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Momentry Team"]
|
authors = ["Momentry Team"]
|
||||||
description = "Digital asset management system with video analysis and RAG"
|
description = "Digital asset management system with video analysis and RAG"
|
||||||
|
|||||||
@@ -0,0 +1,109 @@
|
|||||||
|
# Admin Team v1.3.4 交接完成
|
||||||
|
|
||||||
|
**交接时间**: 2026-10-12 23:37
|
||||||
|
**状态**: ✅ Release 包已准备好
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 交付内容
|
||||||
|
|
||||||
|
**Release 包位置**:
|
||||||
|
```
|
||||||
|
/Users/accusys/momentry_core_releases/v1.3.4_core/
|
||||||
|
```
|
||||||
|
|
||||||
|
**包含文件** (12 个):
|
||||||
|
|
||||||
|
| 文件 | 大小 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| momentry_v1.3.4 | 45MB | 主程序 binary |
|
||||||
|
| pipeline_worker_v1.3.4 | 9.6MB | Worker binary |
|
||||||
|
| momentry_v1.3.4.md5 | - | MD5 checksum |
|
||||||
|
| momentry_v1.3.4.sha256 | - | SHA256 checksum |
|
||||||
|
| migrations/20261012_add_file_size_columns.sql | - | 数据库迁移 |
|
||||||
|
| monitor_command_queue.sh | - | 队列监控脚本 |
|
||||||
|
| update_file_metadata.py | - | 历史数据更新脚本 |
|
||||||
|
| README.md | - | 快速开始 |
|
||||||
|
| ADMIN_INSTALL_GUIDE.md | - | 完整安装指南 |
|
||||||
|
| RELEASE_INFO.txt | - | Release 信息 |
|
||||||
|
| 2026-10-12_core_team_v1.3.4_release_complete.md | - | Core Team 报告 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Checksums
|
||||||
|
|
||||||
|
```
|
||||||
|
MD5: 45aabf546bc5500b7aa5a4862efbc0ad
|
||||||
|
SHA256: 6042dbb8cacf5f6ffcf239c30d888ddf2cb33a962dbd6b52037d94d8ed8d50c5
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 功能清单
|
||||||
|
|
||||||
|
### Phase 1 (v1.3.4)
|
||||||
|
|
||||||
|
- ✅ 文件元数据显示 (file_size, modified_time)
|
||||||
|
- ✅ 队列监控自动化
|
||||||
|
- ✅ 数据库迁移
|
||||||
|
- ✅ 历史数据更新脚本
|
||||||
|
|
||||||
|
### 测试结果
|
||||||
|
|
||||||
|
- ✅ 所有 P0 测试通过
|
||||||
|
- ✅ API 响应 < 100ms
|
||||||
|
- ✅ 数据覆盖率 99.5% (188/189)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 下一步
|
||||||
|
|
||||||
|
### Admin Team
|
||||||
|
|
||||||
|
1. **制作安装包**
|
||||||
|
- 参考: `ADMIN_INSTALL_GUIDE.md`
|
||||||
|
- 打包: `tar -czf momentry_v1.3.4_installer.tar.gz v1.3.4_core/`
|
||||||
|
|
||||||
|
2. **测试安装**
|
||||||
|
- 在测试环境验证
|
||||||
|
- 确认所有功能正常
|
||||||
|
|
||||||
|
3. **部署生产**
|
||||||
|
- 备份现有系统
|
||||||
|
- 应用迁移
|
||||||
|
- 更新 binary
|
||||||
|
- 验证功能
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 Git 状态
|
||||||
|
|
||||||
|
**Core Team (M5Max128)**:
|
||||||
|
- ✅ Commit: `dc6081fc`
|
||||||
|
- ✅ Tag: `v1.3.4`
|
||||||
|
- ✅ Branch: `release/v1.3.4`
|
||||||
|
|
||||||
|
**Admin Team (M5Max48)**:
|
||||||
|
- ⏸️ 工作区: Phase 2 改动(未 commit)
|
||||||
|
- ⏸️ 已部署: v1.3.4 (旧 commit)
|
||||||
|
- ⏸️ 待决定: 是否更新到 Core Team 版本
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚠️ 待决定事项
|
||||||
|
|
||||||
|
1. **M5Max48 更新**: 是否重新部署正确的 commit 版本
|
||||||
|
2. **Panel Worker plist**: 硬编码路径修正
|
||||||
|
3. **Qdrant Read Stall**: 查询超时机制
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📞 联系方式
|
||||||
|
|
||||||
|
**Core Team**: OpenCode
|
||||||
|
**Admin Team**: M4
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**交接完成**: 2026-10-12 23:37
|
||||||
|
**状态**: ✅ **已交由 Admin Team 制作安装包**
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
# Core Team v1.3.4 Release 完成报告
|
||||||
|
|
||||||
|
**完成时间**: 2026-10-12 23:30
|
||||||
|
**状态**: ✅ 已完成
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ 执行步骤
|
||||||
|
|
||||||
|
### Step 1: 清理工作区
|
||||||
|
|
||||||
|
```bash
|
||||||
|
✅ 创建备份分支: backup/phase1_phase2_wip
|
||||||
|
✅ 暂存所有改动
|
||||||
|
✅ 回到 v1.3.3
|
||||||
|
✅ 创建新分支: release/v1.3.4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 2: 重构 Release
|
||||||
|
|
||||||
|
```bash
|
||||||
|
✅ 删除 Phase 2 内容 (command_timeout.sql)
|
||||||
|
✅ 更新版本号到 1.3.4
|
||||||
|
✅ 更新 Cargo.lock
|
||||||
|
✅ 编译 binary (45MB + 9.6MB)
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 3: Git 提交
|
||||||
|
|
||||||
|
```bash
|
||||||
|
✅ 提交改动: dc6081fc
|
||||||
|
✅ 创建 tag: v1.3.4
|
||||||
|
```
|
||||||
|
|
||||||
|
### Step 4: 创建 Release 包
|
||||||
|
|
||||||
|
```bash
|
||||||
|
✅ Release 目录: /Users/accusys/momentry_core_releases/v1.3.4_core/
|
||||||
|
✅ Binary: momentry_v1.3.4 (45MB)
|
||||||
|
✅ Worker: pipeline_worker_v1.3.4 (9.6MB)
|
||||||
|
✅ Checksums 已创建
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Release 包内容
|
||||||
|
|
||||||
|
**位置**: `/Users/accusys/momentry_core_releases/v1.3.4_core/`
|
||||||
|
|
||||||
|
| 文件 | 大小 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| momentry_v1.3.4 | 45MB | 主程序 |
|
||||||
|
| pipeline_worker_v1.3.4 | 9.6MB | Worker |
|
||||||
|
| migrations/20261012_add_file_size_columns.sql | - | 数据库迁移 |
|
||||||
|
| monitor_command_queue.sh | 4.9K | 监控脚本 |
|
||||||
|
| update_file_metadata.py | 2.4K | 数据更新脚本 |
|
||||||
|
|
||||||
|
**Checksums**:
|
||||||
|
- MD5: `45aabf546bc5500b7aa5a4862efbc0ad`
|
||||||
|
- SHA256: `6042dbb8cacf5f6ffcf239c30d888ddf2cb33a962dbd6b52037d94d8ed8d50c5`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 版本信息
|
||||||
|
|
||||||
|
**Git Commit**: `dc6081fc`
|
||||||
|
**Git Tag**: `v1.3.4`
|
||||||
|
**Branch**: `release/v1.3.4`
|
||||||
|
**Base**: `v1.3.3` (fd28677d)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Phase 1 功能
|
||||||
|
|
||||||
|
1. **文件元数据显示**
|
||||||
|
- ✅ file_size 和 modified_time 字段
|
||||||
|
- ✅ API 返回元数据
|
||||||
|
- ✅ 数据覆盖率 99.5%
|
||||||
|
|
||||||
|
2. **队列监控**
|
||||||
|
- ✅ 每 5 分钟自动检查
|
||||||
|
- ✅ 自动重置卡住命令
|
||||||
|
- ✅ 自动清理异常命令
|
||||||
|
|
||||||
|
3. **数据库迁移**
|
||||||
|
- ✅ 字段已添加
|
||||||
|
- ✅ 索引已创建
|
||||||
|
- ✅ 数据已更新
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 M5Max48 现状
|
||||||
|
|
||||||
|
### Admin Team 交接内容
|
||||||
|
|
||||||
|
**工作区状态**:
|
||||||
|
- 位置: `~/momentry_core`
|
||||||
|
- 状态: 未 commit
|
||||||
|
- 内容: Phase 2 改动(健康检查、超时机制)
|
||||||
|
|
||||||
|
**已部署状态**:
|
||||||
|
- 版本: v1.3.4
|
||||||
|
- Binary MD5:
|
||||||
|
- momentry: 7de78843...
|
||||||
|
- pipeline_worker: 592b45ce...
|
||||||
|
- Migration: timeout_at 已套用
|
||||||
|
|
||||||
|
**交付包**:
|
||||||
|
- 位置: `~/momentry_core_releases/v1.3.4/`
|
||||||
|
- 状态: Admin team 已准备
|
||||||
|
|
||||||
|
**Rollback**:
|
||||||
|
- 位置: `~/backups/pre_v1.3.4_*`
|
||||||
|
- 内容: .pre bins + plists
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🎯 待 Core Team 决定
|
||||||
|
|
||||||
|
### 1. Source Commit
|
||||||
|
|
||||||
|
**问题**: M5Max48 工作区未 commit,build_git_hash 仍显示 fd28677d
|
||||||
|
|
||||||
|
**选项**:
|
||||||
|
- **选项 A**: 重新 build,让 hash 反映真实 commit
|
||||||
|
- **选项 B**: 保持现状,以 version 字段识别
|
||||||
|
- **选项 C**: 等待 Phase 2 完成后一起 commit
|
||||||
|
|
||||||
|
**建议**: 选项 A(重新 build)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. Panel Worker Offline 硬编码修正
|
||||||
|
|
||||||
|
**问题**: plist 文件包含硬编码路径 `/Users/accusys`
|
||||||
|
|
||||||
|
**待修复**:
|
||||||
|
- `~/Library/LaunchAgents/com.momentry.worker.plist`
|
||||||
|
- 其他 plist 文件
|
||||||
|
|
||||||
|
**建议**: 创建模板化 plist
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. Qdrant Read Stall
|
||||||
|
|
||||||
|
**问题**: Qdrant 查询可能卡住
|
||||||
|
|
||||||
|
**待处理**:
|
||||||
|
- 添加超时机制
|
||||||
|
- 监控查询性能
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📝 下一步行动
|
||||||
|
|
||||||
|
### 立即
|
||||||
|
|
||||||
|
1. **验证 M5Max128 release**
|
||||||
|
```bash
|
||||||
|
# 检查 binary
|
||||||
|
ls -lh target/release/momentry
|
||||||
|
|
||||||
|
# 检查 git
|
||||||
|
git log --oneline -3
|
||||||
|
git tag -l "v1.3.*"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **更新 M5Max48**
|
||||||
|
- 决定是否重新 build
|
||||||
|
- 更新 binary 或保持现状
|
||||||
|
|
||||||
|
### 本周
|
||||||
|
|
||||||
|
1. **修复硬编码路径**
|
||||||
|
- 创建 plist 模板
|
||||||
|
- 测试跨机器部署
|
||||||
|
|
||||||
|
2. **解决 Qdrant 问题**
|
||||||
|
- 添加查询超时
|
||||||
|
- 监控性能
|
||||||
|
|
||||||
|
### 下周
|
||||||
|
|
||||||
|
1. **Phase 2 开发**
|
||||||
|
- 健康检查 API
|
||||||
|
- timeout_at 机制
|
||||||
|
- 架构改进
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ 交付状态
|
||||||
|
|
||||||
|
### M5Max128 (Core Team)
|
||||||
|
|
||||||
|
- ✅ Git commit: dc6081fc
|
||||||
|
- ✅ Tag: v1.3.4
|
||||||
|
- ✅ Binary: 45MB
|
||||||
|
- ✅ Release 包: v1.3.4_core/
|
||||||
|
|
||||||
|
### M5Max48 (Admin Team)
|
||||||
|
|
||||||
|
- ✅ 已部署: v1.3.4
|
||||||
|
- ✅ Migration: 已应用
|
||||||
|
- ⏸️ 工作区: 未 commit
|
||||||
|
- ⏸️ 待决定: 重新 build 或保持现状
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📞 沟通建议
|
||||||
|
|
||||||
|
### 给 Admin Team
|
||||||
|
|
||||||
|
**说明**:
|
||||||
|
- Core team 已完成 v1.3.4 release
|
||||||
|
- Git commit: dc6081fc
|
||||||
|
- Tag: v1.3.4
|
||||||
|
- M5Max48 工作区 Phase 2 改动已备份
|
||||||
|
|
||||||
|
**决策点**:
|
||||||
|
1. M5Max48 是否重新 build?
|
||||||
|
2. Panel Worker plist 硬编码修正优先级?
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**完成时间**: 2026-10-12 23:31
|
||||||
|
**状态**: ✅ **Core Team v1.3.4 Release 完成**
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
-- Migration: Add timeout_at to command_queue
|
||||||
|
-- Date: 2026-10-12
|
||||||
|
-- Purpose: Pipeline Worker timeout / self-healing (Phase 1 of pipeline worker refactor)
|
||||||
|
-- consume() stamps timeout_at = NOW() + timeout_seconds; the worker monitor
|
||||||
|
-- task and the external command_monitor reset rows whose timeout_at has passed.
|
||||||
|
|
||||||
|
ALTER TABLE command_queue
|
||||||
|
ADD COLUMN IF NOT EXISTS timeout_at TIMESTAMP WITH TIME ZONE;
|
||||||
|
|
||||||
|
COMMENT ON COLUMN command_queue.timeout_at IS 'Command timeout timestamp (set on consume, cleared on reset)';
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS idx_command_queue_timeout
|
||||||
|
ON command_queue(timeout_at)
|
||||||
|
WHERE status = 'processing';
|
||||||
@@ -700,9 +700,87 @@ async fn check_http(url: &str) -> ServiceStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize)]
|
||||||
|
pub struct QueueHealth {
|
||||||
|
pub status: String,
|
||||||
|
pub stuck_commands: i64,
|
||||||
|
pub pending_commands: i64,
|
||||||
|
pub processing_commands: i64,
|
||||||
|
pub completed_last_hour: i64,
|
||||||
|
pub failed_last_hour: i64,
|
||||||
|
pub avg_processing_time_ms: Option<f64>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn check_queue_health(pool: &sqlx::PgPool) -> Result<QueueHealth, sqlx::Error> {
|
||||||
|
let stuck_commands: i64 = sqlx::query_scalar(
|
||||||
|
"SELECT COUNT(*) FROM command_queue
|
||||||
|
WHERE status = 'processing'
|
||||||
|
AND processing_started_at < NOW() - INTERVAL '1 hour'",
|
||||||
|
)
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let pending_commands: i64 =
|
||||||
|
sqlx::query_scalar("SELECT COUNT(*) FROM command_queue WHERE status = 'pending'")
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let processing_commands: i64 =
|
||||||
|
sqlx::query_scalar("SELECT COUNT(*) FROM command_queue WHERE status = 'processing'")
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let completed_last_hour: i64 = sqlx::query_scalar(
|
||||||
|
"SELECT COUNT(*) FROM command_queue
|
||||||
|
WHERE status = 'completed'
|
||||||
|
AND processing_completed_at > NOW() - INTERVAL '1 hour'",
|
||||||
|
)
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let failed_last_hour: i64 = sqlx::query_scalar(
|
||||||
|
"SELECT COUNT(*) FROM command_queue
|
||||||
|
WHERE status = 'failed'
|
||||||
|
AND processing_completed_at > NOW() - INTERVAL '1 hour'",
|
||||||
|
)
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let avg_processing_time_ms: Option<f64> = sqlx::query_scalar(
|
||||||
|
"SELECT AVG(EXTRACT(EPOCH FROM (processing_completed_at - processing_started_at)) * 1000)::double precision
|
||||||
|
FROM command_queue
|
||||||
|
WHERE status = 'completed'
|
||||||
|
AND processing_completed_at > NOW() - INTERVAL '1 hour'",
|
||||||
|
)
|
||||||
|
.fetch_one(pool)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
let status = if stuck_commands > 0 { "unhealthy" } else { "healthy" };
|
||||||
|
|
||||||
|
Ok(QueueHealth {
|
||||||
|
status: status.to_string(),
|
||||||
|
stuck_commands,
|
||||||
|
pending_commands,
|
||||||
|
processing_commands,
|
||||||
|
completed_last_hour,
|
||||||
|
failed_last_hour,
|
||||||
|
avg_processing_time_ms,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn health_queue(
|
||||||
|
State(state): State<AppState>,
|
||||||
|
) -> Result<Json<QueueHealth>, (StatusCode, String)> {
|
||||||
|
match check_queue_health(state.db.pool()).await {
|
||||||
|
Ok(health) => Ok(Json(health)),
|
||||||
|
Err(e) => Err((StatusCode::INTERNAL_SERVER_ERROR, e.to_string())),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn health_routes() -> Router<AppState> {
|
pub fn health_routes() -> Router<AppState> {
|
||||||
Router::new()
|
Router::new()
|
||||||
.route("/health", get(health))
|
.route("/health", get(health))
|
||||||
.route("/health/detailed", get(health_detailed))
|
.route("/health/detailed", get(health_detailed))
|
||||||
.route("/health/consistency", get(health_consistency))
|
.route("/health/consistency", get(health_consistency))
|
||||||
|
.route("/health/queue", get(health_queue))
|
||||||
}
|
}
|
||||||
|
|||||||
+5
-1
@@ -20,7 +20,7 @@ use super::docs;
|
|||||||
use super::face_filter;
|
use super::face_filter;
|
||||||
use super::files;
|
use super::files;
|
||||||
use super::health;
|
use super::health;
|
||||||
use super::health::{health, health_consistency, health_detailed};
|
use super::health::{health, health_consistency, health_detailed, health_queue};
|
||||||
use super::identities;
|
use super::identities;
|
||||||
use super::identity_api;
|
use super::identity_api;
|
||||||
use super::identity_binding;
|
use super::identity_binding;
|
||||||
@@ -173,6 +173,10 @@ pub async fn start_server(host: &str, port: u16) -> anyhow::Result<()> {
|
|||||||
.route(
|
.route(
|
||||||
"/api/v1/health/consistency",
|
"/api/v1/health/consistency",
|
||||||
axum::routing::get(health_consistency),
|
axum::routing::get(health_consistency),
|
||||||
|
)
|
||||||
|
.route(
|
||||||
|
"/api/v1/health/queue",
|
||||||
|
axum::routing::get(health_queue),
|
||||||
);
|
);
|
||||||
|
|
||||||
let app = Router::new()
|
let app = Router::new()
|
||||||
|
|||||||
@@ -32,6 +32,38 @@ async fn main() -> Result<()> {
|
|||||||
|
|
||||||
info!("Connected to database");
|
info!("Connected to database");
|
||||||
|
|
||||||
|
// 启动超时监控任务:每 5 分钟重置超时(processing 超过 timeout_at)的命令
|
||||||
|
let db_monitor = db.clone();
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let mut interval = tokio::time::interval(Duration::from_secs(300));
|
||||||
|
loop {
|
||||||
|
interval.tick().await;
|
||||||
|
match sqlx::query(
|
||||||
|
"UPDATE command_queue
|
||||||
|
SET status = 'pending',
|
||||||
|
consumer_id = NULL,
|
||||||
|
consumer_group = NULL,
|
||||||
|
processing_started_at = NULL,
|
||||||
|
timeout_at = NULL,
|
||||||
|
retry_count = retry_count + 1
|
||||||
|
WHERE status = 'processing'
|
||||||
|
AND timeout_at IS NOT NULL
|
||||||
|
AND timeout_at < NOW()
|
||||||
|
AND retry_count < max_retries",
|
||||||
|
)
|
||||||
|
.execute(&db_monitor)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(result) => {
|
||||||
|
if result.rows_affected() > 0 {
|
||||||
|
info!("Reset {} timed out commands", result.rows_affected());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => error!("Failed to reset timed out commands: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// 创建 Pipeline Worker
|
// 创建 Pipeline Worker
|
||||||
let worker = PipelineWorker::new(db);
|
let worker = PipelineWorker::new(db);
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ impl PipelineWorker {
|
|||||||
max_messages: 5,
|
max_messages: 5,
|
||||||
timeout_ms: 5000,
|
timeout_ms: 5000,
|
||||||
auto_commit: false,
|
auto_commit: false,
|
||||||
|
timeout_seconds: 3600,
|
||||||
},
|
},
|
||||||
).await?;
|
).await?;
|
||||||
|
|
||||||
|
|||||||
@@ -103,7 +103,8 @@ impl CommandQueue {
|
|||||||
SET status = 'processing',
|
SET status = 'processing',
|
||||||
consumer_group = $1,
|
consumer_group = $1,
|
||||||
consumer_id = $2,
|
consumer_id = $2,
|
||||||
processing_started_at = NOW()
|
processing_started_at = NOW(),
|
||||||
|
timeout_at = NOW() + ($5::bigint * INTERVAL '1 second')
|
||||||
WHERE message_id IN (
|
WHERE message_id IN (
|
||||||
SELECT message_id
|
SELECT message_id
|
||||||
FROM command_queue
|
FROM command_queue
|
||||||
@@ -127,6 +128,7 @@ impl CommandQueue {
|
|||||||
options.consumer_id,
|
options.consumer_id,
|
||||||
queue_name,
|
queue_name,
|
||||||
options.max_messages as i64,
|
options.max_messages as i64,
|
||||||
|
options.timeout_seconds,
|
||||||
)
|
)
|
||||||
.fetch_all(&self.db)
|
.fetch_all(&self.db)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
@@ -241,10 +241,13 @@ pub struct ConsumeOptions {
|
|||||||
pub timeout_ms: i32,
|
pub timeout_ms: i32,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub auto_commit: bool,
|
pub auto_commit: bool,
|
||||||
|
#[serde(default = "default_timeout_seconds")]
|
||||||
|
pub timeout_seconds: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn default_max_messages() -> i32 { 10 }
|
fn default_max_messages() -> i32 { 10 }
|
||||||
fn default_timeout_ms() -> i32 { 5000 }
|
fn default_timeout_ms() -> i32 { 5000 }
|
||||||
|
fn default_timeout_seconds() -> i64 { 3600 }
|
||||||
|
|
||||||
/// Billing 上下文
|
/// Billing 上下文
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
|
|||||||
Reference in New Issue
Block a user