fix: Task 13 완료 - TaskAggregator/WorkersDb 예외 처리 및 RssHome viewLifecycleOwner 스코프 전환
- TaskAggregator.kt: * SupervisorJob 기반 공유 aggregatorScope 도입 * refreshSystemInfo(), refreshNewsFeeds() 전체 try-catch 보강 및 개별 피드 수집기를 runCatching으로 격리해 단일 사이트 실패가 전체 피드 수집을 중단하지 않도록 개선 - RssHome.kt: * updateQuery() 및 스와이프 DB 갱신 코루틴을 viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO)로 전환, 불필요한 infosJob?.start() 제거 및 Realm writeBlocking 예외 방어 추가 - WorkersDb.kt: * insertExpressions() writeBlocking 트랜잭션에 try-catch 및 에러 로깅 추가 - TODO.md: 2-4, 3-3 항목 완료 처리 - 검증: ./gradlew :app:compileDebugKotlin 빌드 성공 확인 (3s)
This commit is contained in:
@@ -84,7 +84,7 @@
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/helpers/ForeGroundService.kt:426, 542-598` — `companion object`의 `targetUrls`(일반 `ArrayList`)와 `lastProGress`, `currentProcessId`가 여러 `CoroutineScope(Dispatchers.IO)`에서 동기화 없이 접근/수정됨.
|
||||
- **작업**: `Channel` 또는 `Mutex` 기반 순차 다운로드 큐로 전환하고, `targetUrls`를 스레드 안전 구조로 교체.
|
||||
|
||||
- [ ] **2-4. `RssHome` Realm Flow 수집과 UI 리스트 동기화 정리**
|
||||
- [x] **2-4. `RssHome` Realm Flow 수집과 UI 리스트 동기화 정리**
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt:804-817` — `CoroutineScope(Dispatchers.IO)`에서 `synchronized(lasted)` 블록 안에서 `WorkersDb.getRealm()`으로 `copyFromRealm()` 후 `commandHandler.post(infoUpdate)` 호출. `infosJob?.start()`는 `launch` 직후 불필요한 호출이며, Fragment `onDestroyView()` 시 `infosJob` 취소 및 `lasted` 접근 동기화 일원화 필요.
|
||||
|
||||
---
|
||||
@@ -101,7 +101,7 @@
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt:50-52` — `geocoder.getFromLocation(...) { addresses -> addresses.first()?.let { ... } }`에서 `addresses`가 빈 리스트일 경우 `NoSuchElementException` 발생 가능 (`105`, `127`행에서도 `addresses.first()` 재호출).
|
||||
- **작업**: `addresses.firstOrNull()?.let { address -> ... }`로 변경하고 단일 변수 `address` 재사용.
|
||||
|
||||
- [ ] **3-3. `WorkersDb` 및 `TaskAggregator` Realm 트랜잭션 예외 처리**
|
||||
- [x] **3-3. `WorkersDb` 및 `TaskAggregator` Realm 트랜잭션 예외 처리**
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt:88-160` — `writeBlocking` 호출 시 예외 처리가 없어 DB 잠금/마이그레이션/스키마 오류 시 크래시 위험.
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/workers/TaskAggregator.kt:16-55` — `CoroutineScope(Dispatchers.IO).launch` 내부에 `try-catch`가 없어 `AppInfoGetter`/`ContactInfoGetter` 또는 `realm.write` 실패 시 조용히 실패하거나 앱 크래시 유발.
|
||||
- **작업**: `TaskAggregator`에 `try-catch` 및 실패 로깅 추가, 메인 스레드에서의 `writeBlocking` 호출 여부 점검 후 비동기 `write`로 전환.
|
||||
|
||||
Reference in New Issue
Block a user