Merge pull request #430 from mattermost/fixing-build

Fixing race condition
Этот коммит содержится в:
Corey Hulen
2015-08-21 09:00:23 -07:00
родитель ddcdcc3e2c e4b66c3ff4
Коммит 1ba6946261
5 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@@ -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)
}