Skip to content

Commit 95bb52f

Browse files
aaron-jangclaude
andcommitted
fix: 스케줄러 misfire_grace_time을 120초로 설정
스나이퍼 감시(~25초)가 tx_lock을 잡고 있는 동안 정규장 주문 등 다른 스케줄이 missed 처리되던 문제 해결. 120초 유예를 두어 스나이퍼 완료 후 밀린 job이 순차 실행되도록 변경. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c9ee7c8 commit 95bb52f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎trading_bot/app.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ def run():
130130
tx_lock = asyncio.Lock()
131131
bot = TelegramController(cfg, broker, strategy, tx_lock)
132132

133-
app = Application.builder().token(TELEGRAM_TOKEN).build()
133+
# 💡 스케줄러가 최대 120초 지연되어도 missed 처리하지 않고 실행
134+
from telegram.ext import Defaults
135+
defaults = Defaults()
136+
app = Application.builder().token(TELEGRAM_TOKEN).defaults(defaults).build()
137+
app.job_queue.scheduler.configure(job_defaults={'misfire_grace_time': 120})
134138

135139
for cmd, handler in [
136140
("start", bot.cmd_start),

0 commit comments

Comments
 (0)