fix: tighten password and surface persistence errors
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user