summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-12-04 10:43:44 -0500
committerJoramWilander <jwawilander@gmail.com>2015-12-04 10:43:44 -0500
commit8250d69d7ce57926c2c11be35640579a372063f5 (patch)
treeb4606dfe5177f964e1a4e0d17eac536e8e66b50c /store
parent622fbc67402fe36bc01163a5a80643a15758e094 (diff)
downloadchat-8250d69d7ce57926c2c11be35640579a372063f5.tar.gz
chat-8250d69d7ce57926c2c11be35640579a372063f5.tar.bz2
chat-8250d69d7ce57926c2c11be35640579a372063f5.zip
Fix possible race condition on when creating new channels
Diffstat (limited to 'store')
-rw-r--r--store/sql_channel_store.go3
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)