Skip to content

fix(bridge): stop re-running detail discovery for every device on restart (1.8.75) - #118

Merged
1bobby-git merged 3 commits into
mainfrom
fix/skip-complete-detail-discovery
Nov 10, 2026
Merged

1bobby-git merged 3 commits into
mainfrom
fix/skip-complete-detail-discovery

Conversation

@1bobby-git

@1bobby-git 1bobby-git commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

문제

Bridge가 시작될 때마다 상세 조회(detail discovery)가 모든 기기를 다시 엽니다. 시도 기록이 브라우저 컨텍스트 시작 때마다 초기화되고, 첫 시도는 무조건 조회하기 때문입니다. 실측(2026-11-10): Bridge 시작 후 약 3시간 동안 1520초마다 Chrome 렌더러가 새로 뜨고 Bridge CPU가 2448%였습니다. 조회가 끝나자 2~3%로 내려갔습니다. 기기 239대 중 159대는 1회, 80대는 2회 조회했습니다.

변경

  1. 완성된 기기 건너뛰기: 기기 컨트롤은 저장된 인벤토리에서 복원되므로, 상세 컨트롤이 이미 완성된 기기(조작 컨트롤과 주 스위치의 정확한 토글이 있는 기기)는 조회하지 않습니다.
  2. 소진 기록 유지: 최대 시도(maxAttempts)를 다 써도 완성되지 않은 기기는 /data/detail-discovery.json에 기록합니다. 기록 내용은 기기 id, 이름의 sha256, 시각입니다. 기록된 기기는 재시작 후에도 7일 동안, 또는 이름이 바뀔 때까지 다시 조회하지 않습니다.
    • 카메라 이미지 기기는 기록하지 않고 지금처럼 매번 조회합니다.
    • 포그라운드 조작 때문에 선점된 시도는 소진으로 치지 않습니다.
    • 파일이 없거나 손상되면 기록이 없는 것으로 보고 다시 조회합니다. 저장에 실패해도 메모리 기록은 그대로 적용합니다.

예상 효과 (추정)

재시작 후 조회 횟수가 약 319회에서 카메라 몇 회로 줄어듭니다. 단 이 버전으로 처음 시작할 때는 아직 소진 기록이 없으므로, 미완성 기기를 한 번 더 2회씩 조회합니다.

배포

사용자 요청에 따라 다음 Bridge 릴리스에 함께 넣습니다. 이 PR을 main에 병합하면 Release 워크플로가 돌기 때문에 지금은 병합하지 않습니다. 버전·CHANGELOG는 릴리스할 때 올립니다.

검증

  • vitest: 1953개 통과. 실패 2개는 Windows 전용 tar 테스트(tests/local-addon-update-helper.test.ts)로, CI에서는 통과합니다.
  • npm run typecheck 통과.
  • 새 테스트: 재시작 후 소진 기기를 건너뜀, 7일 뒤 다시 조회, 이름이 바뀌면 다시 조회, 선점은 기록하지 않음, 카메라는 계속 조회, 파일 저장소의 왕복·손상·형식 오류 처리, 이름 평문을 저장하지 않음.

🤖 Generated with Claude Code

1bobby-git and others added 2 commits November 10, 2026 15:37
… restart

Detail discovery attempts reset on every browser context start, so each
Bridge restart re-opened a SmartThings page for every device (~319 visits
for 239 devices), keeping Bridge at 30-40% CPU for about three hours.
Controls are restored from the persisted inventory, so devices whose
detail controls are already complete no longer need a visit. Camera image
devices and incomplete devices are still inspected as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Devices that stay incomplete after maxAttempts visits were visited twice
again on every Bridge restart (80 devices in the 2026-11-10 measurement).
Record them in /data/detail-discovery.json (device id, sha256 of the name,
time) and skip them for seven days or until the name changes. Camera image
devices are never recorded, and preempted visits do not count. A missing
or corrupt file only means devices are visited again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@1bobby-git 1bobby-git changed the title fix(bridge): skip detail discovery for devices already complete after restart fix(bridge): stop re-running detail discovery for every device on restart Nov 10, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@1bobby-git 1bobby-git changed the title fix(bridge): stop re-running detail discovery for every device on restart fix(bridge): stop re-running detail discovery for every device on restart (1.8.75) Nov 10, 2026
@1bobby-git
1bobby-git merged commit 674aa2b into main Nov 10, 2026
7 checks passed
@1bobby-git
1bobby-git deleted the fix/skip-complete-detail-discovery branch November 10, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant