fix: Task 12 완료 - ForeGroundService targetUrls 동기화 및 YoutubeDL Mutex 직렬화
- ForeGroundService.kt: * addToTargetYtubeUrl(): targetUrls 접근을 synchronized(targetUrls) 블록으로 보호 * downloadVideo(): 비관리 CoroutineScope 대신 serviceScope.launch(Dispatchers.IO) 사용 및 downloadMutex.withLock 적용으로 YoutubeDL 동시 실행 경쟁 방지 * currentProcessId, lastProGress에 @Volatile 적용 및 finally 블록에서 대기열 후속 작업 안전 트리거 * launchAppleMusic(): CoroutineScope(Dispatchers.Main) -> serviceScope.launch(Dispatchers.Main) 전환 - TODO.md: 2-3 항목 완료 처리 - 검증: ./gradlew :app:compileDebugKotlin 빌드 성공 확인 (3s)
This commit is contained in:
@@ -80,7 +80,7 @@
|
||||
- `app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt:68, 106` — `pushLocation()` 호출마다 `Executors.newSingleThreadScheduledExecutor().schedule(...)`로 새 스레드 풀을 생성하고 `shutdown()`을 호출하지 않음. 또한 `130-131`행에서 `Companion.lastWeather.clear()` / `addAll()`을 백그라운드 스레드에서 동기화 없이 수정함.
|
||||
- **작업**: 단일 공유 `CoroutineScope` + `delay(5000)`으로 대체하고 `lastWeather` 갱신 시 스레드 안전한 컬렉션 또는 `StateFlow` 사용.
|
||||
|
||||
- [ ] **2-3. `ForeGroundService` 공유 상태 및 `YoutubeDL` 동시 실행 제어**
|
||||
- [x] **2-3. `ForeGroundService` 공유 상태 및 `YoutubeDL` 동시 실행 제어**
|
||||
- `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`를 스레드 안전 구조로 교체.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user