diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2015-12-07 10:03:13 -0500 |
---|---|---|
committer | Harrison Healey <harrisonmhealey@gmail.com> | 2015-12-07 10:03:13 -0500 |
commit | 5c684a199b099cb465802282816ae1d93a74a954 (patch) | |
tree | d1e3988ebc754610f9cee0feca60ceac7733ab66 /store | |
parent | 93b60b9e39b9833c39702ad1ad801f99e9d5ce13 (diff) | |
parent | 8250d69d7ce57926c2c11be35640579a372063f5 (diff) | |
download | chat-5c684a199b099cb465802282816ae1d93a74a954.tar.gz chat-5c684a199b099cb465802282816ae1d93a74a954.tar.bz2 chat-5c684a199b099cb465802282816ae1d93a74a954.zip |
Merge pull request #1621 from mattermost/plt-1331
PLT-1331 Fix possible race condition when creating new channels
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_channel_store.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index badaa4d13..2cbec705b 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -246,7 +246,8 @@ func (s SqlChannelStore) Get(id string) StoreChannel { go func() { result := StoreResult{} - if obj, err := s.GetReplica().Get(model.Channel{}, id); err != nil { + // reading from master due to expected race condition when creating channels + if obj, err := s.GetMaster().Get(model.Channel{}, id); err != nil { result.Err = model.NewAppError("SqlChannelStore.Get", "We encountered an error finding the channel", "id="+id+", "+err.Error()) } else if obj == nil { result.Err = model.NewAppError("SqlChannelStore.Get", "We couldn't find the existing channel", "id="+id) |