feat:level4

This commit is contained in:
Оля Мороз
2026-10-20 18:35:44 +03:00
parent 4349a539d9
commit ae53d39ccc
20 changed files with 775 additions and 26 deletions
+3 -2
View File
@@ -50,7 +50,7 @@ func main() {
sessions := domain.NewSessionStore(store, cache, cfg.SessionTTL)
handler := &api.Handler{Store: store, Sessions: sessions}
router := api.NewRouter(handler)
router := api.NewRouter(handler, cfg.InstanceID)
srv := &http.Server{
Addr: fmt.Sprintf("%s:%d", cfg.Host, cfg.Port),
@@ -66,6 +66,7 @@ func main() {
go func() {
log.Printf("messenger listening on %s (env=%s, session_ttl=%s)", srv.Addr, cfg.Env, cfg.SessionTTL)
log.Printf("instance_id=%s", cfg.InstanceID)
if err := srv.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatalf("server error: %v", err)
}
@@ -73,7 +74,7 @@ func main() {
<-stop
log.Println("shutting down...")
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
defer cancel()
_ = srv.Shutdown(ctx)
log.Println("stopped")