Merge pull request #430 from mattermost/fixing-build
Fixing race condition
Этот коммит содержится в:
4
.gitignore
поставляемый
4
.gitignore
поставляемый
@@ -50,3 +50,7 @@ web/sass-files/sass/.sass-cache/
|
||||
# Default local file storage
|
||||
data/*
|
||||
api/data/*
|
||||
|
||||
.agignore
|
||||
.ctags
|
||||
tags
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -5,6 +5,7 @@ package model
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
l4g "code.google.com/p/log4go"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
@@ -93,6 +94,7 @@ func getCookie(name string, resp *http.Response) *http.Cookie {
|
||||
|
||||
func (c *Client) Must(result *Result, err *AppError) *Result {
|
||||
if err != nil {
|
||||
l4g.Close()
|
||||
time.Sleep(time.Second)
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/utils"
|
||||
)
|
||||
@@ -153,8 +154,10 @@ func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel {
|
||||
|
||||
channel.ExtraUpdated()
|
||||
|
||||
if count, err := s.GetMaster().Update(channel); err != nil || count != 1 {
|
||||
if count, err := s.GetMaster().Update(channel); err != nil {
|
||||
result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "Problem updating members last updated time", "id="+channel.Id+", "+err.Error())
|
||||
} else if count != 1 {
|
||||
result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "Problem updating members last updated time", fmt.Sprintf("id=%v, count=%v", channel.Id, count))
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
l4g "code.google.com/p/log4go"
|
||||
"github.com/mattermost/platform/model"
|
||||
"time"
|
||||
)
|
||||
|
||||
type StoreResult struct {
|
||||
@@ -17,6 +19,8 @@ type StoreChannel chan StoreResult
|
||||
func Must(sc StoreChannel) interface{} {
|
||||
r := <-sc
|
||||
if r.Err != nil {
|
||||
l4g.Close()
|
||||
time.Sleep(time.Second)
|
||||
panic(r.Err)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user