fix: tighten password and surface persistence errors

This commit is contained in:
Your Name
2026-05-28 20:38:34 +08:00
parent caad1aba0c
commit 9cc5892565
7 changed files with 228 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ import (
"context"
"encoding/json"
"io"
"log"
"time"
"github.com/gin-gonic/gin"
@@ -87,10 +88,16 @@ func (m *OperationLogMiddleware) Record() gin.HandlerFunc {
UserAgent: c.Request.UserAgent(),
}
if m == nil || m.repo == nil {
return
}
go func(entry *domain.OperationLog) {
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
_ = m.repo.Create(ctx, entry)
if err := m.repo.Create(ctx, entry); err != nil {
log.Printf("[operation-log] create failed: %v", err)
}
}(logEntry)
}
}