修復 too many connection 問題

This commit is contained in:
2025-09-21 02:46:16 +08:00
parent a36ab3c98d
commit 808d5bb52c
36 changed files with 5582 additions and 249 deletions

View File

@@ -0,0 +1,28 @@
'use client';
import { useEffect } from 'react';
import { clientCleanup } from '@/lib/client-connection-cleanup';
// 客戶端連線清理組件
export function ClientConnectionCleanup() {
useEffect(() => {
// 確保在瀏覽器環境中執行
if (typeof window === 'undefined') return;
// 初始化客戶端清理
console.log('🖥️ 客戶端連線清理組件已載入');
// 可以在這裡添加額外的初始化邏輯
const clientId = clientCleanup.getClientId();
console.log('🆔 客戶端 ID:', clientId);
// 清理函數(組件卸載時)
return () => {
console.log('🔄 客戶端連線清理組件卸載');
// 可以在這裡添加清理邏輯
};
}, []);
// 這個組件不渲染任何內容
return null;
}