v0.3.1: HotDealPollingWorker.kt

This commit is contained in:
2026-08-21 00:56:08 +00:00
parent c0574d7777
commit 8ec2e61f66
@@ -116,11 +116,18 @@ class HotDealPollingWorker @AssistedInject constructor(
// 8. 알림 발송 상태 업데이트 // 8. 알림 발송 상태 업데이트
dealDao.markAsNotified(newDeals.map { it.id }) dealDao.markAsNotified(newDeals.map { it.id })
// 9. 오래된 데이터 정리 (3일 이상 - 배터리/데이터 절약) // 9. 인기글 상태 업데이트 (신규+기존 딜 모두 HOT 마킹)
val popularDealIds = allDeals.filter { it.isPopular }.map { it.id }
if (popularDealIds.isNotEmpty()) {
dealDao.markAsPopular(popularDealIds)
Log.d(TAG, "인기글 마킹: ${popularDealIds.size}")
}
// 10. 오래된 데이터 정리 (3일 이상 - 배터리/데이터 절약)
val threshold = System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000L) val threshold = System.currentTimeMillis() - (3 * 24 * 60 * 60 * 1000L)
dealDao.deleteOldDeals(threshold) dealDao.deleteOldDeals(threshold)
Log.d(TAG, "===== 핫딜 폴 완료 =====") Log.d(TAG, "===== 핫딜 폴 완료 =====")
Result.success() Result.success()
} catch (e: Exception) { } catch (e: Exception) {
Log.e(TAG, " 오류: ${e.message}", e) Log.e(TAG, " 오류: ${e.message}", e)