summaryrefslogtreecommitdiffstats
path: root/api/context.go
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2015-08-21 09:00:23 -0700
committerCorey Hulen <corey@hulen.com>2015-08-21 09:00:23 -0700
commit1ba694626128870698a6e011047ed899f5f90ba4 (patch)
treec49dd9fd25517457215f2e893b65a8760daba3a7 /api/context.go
parentddcdcc3e2c85efbfd1d91d69c0f5c0af7c7cb1c7 (diff)
parente4b66c3ff41bcac47f026151a7cb1b19b1217672 (diff)
downloadchat-1ba694626128870698a6e011047ed899f5f90ba4.tar.gz
chat-1ba694626128870698a6e011047ed899f5f90ba4.tar.bz2
chat-1ba694626128870698a6e011047ed899f5f90ba4.zip
Merge pull request #430 from mattermost/fixing-build
Fixing race condition
Diffstat (limited to 'api/context.go')
-rw-r--r--api/context.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/api/context.go b/api/context.go
index e3f279e90..8babf85f2 100644
--- a/api/context.go
+++ b/api/context.go
@@ -196,7 +196,9 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
func (c *Context) LogAudit(extraInfo string) {
audit := &model.Audit{UserId: c.Session.UserId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
- Srv.Store.Audit().Save(audit)
+ if r := <-Srv.Store.Audit().Save(audit); r.Err != nil {
+ c.LogError(r.Err)
+ }
}
func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
@@ -206,7 +208,9 @@ func (c *Context) LogAuditWithUserId(userId, extraInfo string) {
}
audit := &model.Audit{UserId: userId, IpAddress: c.IpAddress, Action: c.Path, ExtraInfo: extraInfo, SessionId: c.Session.AltId}
- Srv.Store.Audit().Save(audit)
+ if r := <-Srv.Store.Audit().Save(audit); r.Err != nil {
+ c.LogError(r.Err)
+ }
}
func (c *Context) LogError(err *model.AppError) {