fix: review findings (async SQS dispatcher, backoff, batch insert, shutdown order, pagination, HMAC) + loadtest fixes; v0.1.6

This commit is contained in:
“Naeel”
2026-08-16 18:24:09 +04:00
parent 090cedca67
commit 3fedf9317c
27 changed files with 581 additions and 122 deletions
+6 -2
View File
@@ -89,7 +89,7 @@ func main() {
}
// HTTP API — в основном потоке.
router := api.NewRouter(h, log, cfg.AuthTestMode, version)
router := api.NewRouter(h, log, cfg.AuthTestMode, cfg.JwtHMACSecret, version)
server := &http.Server{
Addr: ":" + cfg.APIPort,
Handler: router,
@@ -114,9 +114,13 @@ func main() {
}
}()
// Сервер: при завершении ctx — гасим.
// Сервер гаснет ПОСЛЕДНИМ: сначала останавливаются bridge+consumer
// (ctx → disconnect MQTT → flush SQS), потом HTTP. Иначе платформа
// может убить контейнер по liveness, пока bridge/consumer ещё работают
// (фикс MEDIUM из ревью 2026-08-16).
go func() {
<-ctx.Done()
wg.Wait()
shutdownCtx, shutdownCancel := context.WithTimeout(context.Background(), 10*time.Second)
defer shutdownCancel()
_ = server.Shutdown(shutdownCtx)