mirror of
https://github.com/tiennm99/miti99bot.git
synced 2026-09-10 04:20:01 +00:00
Sequential List + N GetItem made /stats latency scale with the number of tracked commands. On a cold Lambda container with ~25 commands the cumulative DynamoDB round-trips can exceed the 10s webhook handler deadline; the trailing chathelper.Reply -> b.SendMessage then fails on a cancelled ctx and the dispatcher only logs the error, leaving the user with no reply at all. Fan the per-key GetJSONs out into goroutines joined by sync.WaitGroup. Wall-clock latency collapses to ~1 round-trip while preserving the per-key error isolation (a single GetJSON failure still drops only its own row). Storage interface unchanged; no race regression vs. the prior per-item write pattern.