Files
backend/cmd/server/main.go
lan 9f3215d4eb
All checks were successful
Build Backend / build (push) Successful in 2m0s
Build Backend / build-docker (push) Successful in 7m38s
fix(server): improve message handling and data privacy
- fix unread count calculation logic in message repository
- implement logic to retrieve other participant's last read sequence in conversation handlers
- mask real names in verification record responses for privacy
- improve error reporting in main entry point by using stderr instead of zap logger during initialization
2026-05-09 17:25:09 +08:00

44 lines
784 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
"time"
"go.uber.org/zap"
)
func main() {
// 初始化应用程序Wire 自动生成)
app, err := InitializeApp()
if err != nil {
fmt.Fprintf(os.Stderr, "failed to initialize app: %v\n", err)
os.Exit(1)
}
// 启动应用程序
ctx := context.Background()
if err := app.Start(ctx); err != nil {
app.Logger.Fatal("failed to start app",
zap.Error(err),
)
}
// 优雅关闭
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
shutdownCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
if err := app.Stop(shutdownCtx); err != nil {
app.Logger.Error("Error during shutdown",
zap.Error(err),
)
}
}