(sourceId: string, sessions: Array<{ name: string; remoteSessionId: string }>)
| 392 | // ==================== 导入会话管理 ==================== |
| 393 | |
| 394 | async function addImportSessions(sourceId: string, sessions: Array<{ name: string; remoteSessionId: string }>) { |
| 395 | try { |
| 396 | const added = await transport.addImportSessions(sourceId, sessions) |
| 397 | await fetchDataSources() |
| 398 | if (added.length > 0) { |
| 399 | for (const s of added) pullingIds.value.add(s.id) |
| 400 | pullingIds.value = new Set(pullingIds.value) |
| 401 | pollDataSourceUpdates( |
| 402 | sourceId, |
| 403 | added.map((s) => s.id) |
| 404 | ) |
| 405 | } |
| 406 | return added |
| 407 | } catch (err) { |
| 408 | console.error('[ApiServerStore] Failed to add import sessions:', err) |
| 409 | return [] |
| 410 | } |
| 411 | } |
| 412 | |
| 413 | function pollDataSourceUpdates(sourceId: string, sessionIds: string[], maxAttempts = 24, intervalMs = 5000) { |
| 414 | let attempt = 0 |
nothing calls this directly
no test coverage detected