fix(dashboard): clean up stale position cache on unmatched close events
_handle_close was not clearing _current_positions when no matching OPEN trade was found in DB, causing all subsequent entries for the same symbol+direction to be silently skipped. Also add PYTHONUNBUFFERED=1 and python -u to make log parser crashes visible in docker logs. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -6,7 +6,7 @@ echo "LOG_DIR=${LOG_DIR:-/app/logs}"
|
||||
echo "DB_PATH=${DB_PATH:-/app/data/dashboard.db}"
|
||||
|
||||
# 로그 파서를 백그라운드로 실행
|
||||
python log_parser.py &
|
||||
python -u log_parser.py &
|
||||
PARSER_PID=$!
|
||||
echo "Log parser started (PID: $PARSER_PID)"
|
||||
|
||||
|
||||
@@ -479,6 +479,7 @@ class LogParser:
|
||||
|
||||
if not open_trades:
|
||||
print(f"[LogParser] 경고: {symbol} 청산 감지했으나 열린 포지션 없음")
|
||||
self._current_positions.pop(symbol, None)
|
||||
return
|
||||
|
||||
primary_id = open_trades[0]["id"]
|
||||
|
||||
@@ -23,6 +23,7 @@ services:
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- TZ=Asia/Seoul
|
||||
- PYTHONUNBUFFERED=1
|
||||
- LOG_DIR=/app/logs
|
||||
- DB_PATH=/app/data/dashboard.db
|
||||
- POLL_INTERVAL=5
|
||||
|
||||
Reference in New Issue
Block a user