Files
egg 599802b818 feat: Add Chat UX improvements with notifications and @mention support
- Add ActionBar component with expandable toolbar for mobile
- Add @mention functionality with autocomplete dropdown
- Add browser notification system (push, sound, vibration)
- Add NotificationSettings modal for user preferences
- Add mention badges on room list cards
- Add ReportPreview with Markdown rendering and copy/download
- Add message copy functionality with hover actions
- Add backend mentions field to messages with Alembic migration
- Add lots field to rooms, remove templates
- Optimize WebSocket database session handling
- Various UX polish (animations, accessibility)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 08:20:37 +08:00

27 lines
1.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Change: Optimize WebSocket Database Sessions for Production
**Status**: ✅ COMPLETED - Ready for archive
## Why
目前 WebSocket 連線在整個生命週期中持有單一資料庫 Session造成連線池快速耗盡。當 50+ 用戶同時在線時15 個連線池容量無法支撐導致資料庫操作阻塞或失敗。此外sequence_number 的計算存在競爭條件,可能導致訊息順序錯誤。
## What Changes
- **BREAKING**: 移除 WebSocket 連線的長期 Session 持有模式
- 改用短期 Session 模式:每次 DB 操作獨立取得連線
- 增加連線池容量配置(可透過環境變數調整)
- 修復 sequence_number 競爭條件(使用資料庫層級鎖定)
- 新增環境變數支援動態調整連線池參數
## Impact
- Affected specs: realtime-messaging
- Affected code:
- `app/core/database.py` - 連線池配置
- `app/core/config.py` - 新增環境變數
- `app/modules/realtime/router.py` - WebSocket Session 管理
- `app/modules/realtime/services/message_service.py` - Sequence 鎖定
- `.env.example` - 新增配置說明
- `.env` - 同步更新目前使用的環境變數檔案