This commit is contained in:
beabigegg
2025-09-23 08:27:58 +08:00
parent ed9250db1a
commit 0a89c19fc9
11 changed files with 230 additions and 38 deletions

View File

@@ -135,9 +135,9 @@ def create_app(config_name=None):
# 創建 Celery 實例
app.celery = make_celery(app)
# 初始化 WebSocket
from app.websocket import init_websocket
app.socketio = init_websocket(app)
# WebSocket 功能完全禁用
app.logger.info("🔌 [WebSocket] WebSocket 服務已禁用")
app.socketio = None
# 註冊 Root 路由(提供 SPA 與基本 API 資訊)
try:

View File

@@ -439,8 +439,8 @@ class NotificationService:
logger.info(f"資料庫通知已創建: {notification.notification_uuid} for user {user_id}")
# 觸發 WebSocket 推送
self._send_websocket_notification(notification)
# WebSocket 推送已禁用
# self._send_websocket_notification(notification)
return notification
@@ -611,16 +611,14 @@ class NotificationService:
def _send_websocket_notification(self, notification: Notification):
"""
通過 WebSocket 發送通知
通過 WebSocket 發送通知 - 已禁用
Args:
notification: 通知對象
"""
try:
from app.websocket import send_notification_to_user
send_notification_to_user(notification.user_id, notification.to_dict())
except Exception as e:
logger.error(f"WebSocket 推送通知失敗: {e}")
# WebSocket 功能已完全禁用
logger.debug(f"WebSocket 推送已禁用,跳過通知: {notification.notification_uuid}")
pass
def get_unread_count(self, user_id: int) -> int:
"""