This commit is contained in:
lunaticbum 2026-03-26 18:12:08 +09:00
parent 0f7b7a12c1
commit 1479face39
2 changed files with 14 additions and 5 deletions

View File

@ -518,6 +518,7 @@ object AutoTradingManager {
stopDiscovery() // 발굴 루프 완전 폭파 (내일 8시 30분에 다시 켜짐)
} else if (now.isAfter(H08M30) && now.isBefore(H08M35) && !isSystemReadyToday) {
if (MarketUtil.canTradeToday()) {
SystemSleepPreventer.wakeDisplay()
shouldShowFullWindow = true
println("✅ [System] 오늘은 영업일입니다. 시스템을 가동합니다.")
tryRefreshToken() // 토큰 갱신 및 화면 표시 신호(shouldShowFullWindow = true)
@ -749,7 +750,11 @@ object AutoTradingManager {
private suspend fun waitForNextCycle(minutes: Double) {
println("💤 대기 모드 진입... $minutes")
val endWait = System.currentTimeMillis() + (minutes * 60 * 1000L)
BrowserManager.closeIfIdle(0) // 즉시 닫기
try {
BrowserManager.closeIfIdle(0) // 즉시 닫기
} catch (e: Exception) {
}
while (System.currentTimeMillis() < endWait && isRunning()) {
lastTickTime.set(System.currentTimeMillis()) // 대기 중에도 Watchdog에 생존 신고
println("💤 대기 모드 상태 확인...")

View File

@ -91,10 +91,14 @@ object BrowserManager {
mutex.withLock {
if (_browser != null && System.currentTimeMillis() - lastAccessTime > idleTimeoutMs) {
println("♻️ [SafeScraper] 장시간 대기로 브라우저 자원을 해제합니다.")
_browser?.close()
playwright?.close()
_browser = null
playwright = null
try {
_browser?.close()
playwright?.close()
_browser = null
playwright = null
}catch (e: Exception) {
}
}
}
}