summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/context.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/api/context.go b/api/context.go
index e6439e977..8babf85f2 100644
--- a/api/context.go
+++ b/api/context.go
@@ -195,22 +195,22 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
func (c *Context) LogAudit(extraInfo string) {
- go func() {
- audit := &model.Audit{UserId: c.Session.UserId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
- <-Srv.Store.Audit().Save(audit)
- }()
+ audit := &model.Audit{UserId: c.Session.UserId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
+ if r := <-Srv.Store.Audit().Save(audit); r.Err != nil {
+ c.LogError(r.Err)
+ }
}
func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
- go func() {
- if len(c.Session.UserId) > 0 {
- extraInfo = strings.TrimSpace(extraInfo + " session_user=" + c.Session.UserId)
- }
+ if len(c.Session.UserId) > 0 {
+ extraInfo = strings.TrimSpace(extraInfo + " session_user=" + c.Session.UserId)
+ }
- audit := &model.Audit{UserId: userId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
- <-Srv.Store.Audit().Save(audit)
- }()
+ audit := &model.Audit{UserId: userId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
+ if r := <-Srv.Store.Audit().Save(audit); r.Err != nil {
+ c.LogError(r.Err)
+ }
}
func (c *Context) LogError(err *model.AppError) {