From 1b4135ab0da3c1635fae23f8f64247eb78866819 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 20 Aug 2015 14:40:25 -0700 Subject: Fixing bug --- store/sql_channel_store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'store/sql_channel_store.go') diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index cf34f2847..25cd46088 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -153,8 +153,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 == 0 { + result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "Problem updating members last updated time", "id="+channel.Id) } storeChannel <- result -- cgit v1.2.3-1-g7c22 From 42822df5b3451114e71aff946d755f6dd3cfd1c9 Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Thu, 20 Aug 2015 14:48:04 -0700 Subject: Fixing race condition --- store/sql_channel_store.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'store/sql_channel_store.go') diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 25cd46088..a7577e645 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -4,6 +4,7 @@ package store import ( + "fmt" "github.com/mattermost/platform/model" "github.com/mattermost/platform/utils" ) @@ -155,8 +156,8 @@ func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel { 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 == 0 { - result.Err = model.NewAppError("SqlChannelStore.extraUpdated", "Problem updating members last updated time", "id="+channel.Id) + } 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 -- cgit v1.2.3-1-g7c22