mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-07-24 08:22:57 +00:00
Stats handlers reused the single bounded update context for both upstream price fetches and the final Telegram reply, while per-upstream HTTP timeouts equalled the whole-handler budget. One slow upstream drained the deadline and the reply failed with "context deadline exceeded" (observed on /stock_stats). - add chathelper.FetchContext: fetches run under a child context that reserves a tail of the deadline for the reply, which is sent on the original context - cap kbs/coin/gold/vnappmob HTTP timeouts at 3s so one hung upstream cannot consume the reply budget - fetch held stock/coin prices concurrently (bounded) so total latency tracks the slowest single fetch instead of their sum; per-symbol failures degrade to a "no price" line and the summary still sends