Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
mattermost-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
sysadmin
mattermost
mattermost-server
Commits
b0e367b1
Commit
b0e367b1
authored
Aug 22, 2017
by
Corey Hulen
Committed by
GitHub
Aug 22, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing race in update channel (#7269)
* Fixing race in update channel * Switching to struct copy
parent
1ce079d2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
1 deletion
+15
-1
model/channel.go
model/channel.go
+5
-0
model/channel_test.go
model/channel_test.go
+9
-0
store/sql_channel_store.go
store/sql_channel_store.go
+1
-1
No files found.
model/channel.go
View file @
b0e367b1
...
...
@@ -53,6 +53,11 @@ type ChannelPatch struct {
Purpose
*
string
`json:"purpose"`
}
func
(
o
*
Channel
)
DeepCopy
()
*
Channel
{
copy
:=
*
o
return
&
copy
}
func
(
o
*
Channel
)
ToJson
()
string
{
b
,
err
:=
json
.
Marshal
(
o
)
if
err
!=
nil
{
...
...
model/channel_test.go
View file @
b0e367b1
...
...
@@ -27,6 +27,15 @@ func TestChannelJson(t *testing.T) {
}
}
func
TestChannelCopy
(
t
*
testing
.
T
)
{
o
:=
Channel
{
Id
:
NewId
(),
Name
:
NewId
()}
ro
:=
o
.
DeepCopy
()
if
o
.
Id
!=
ro
.
Id
{
t
.
Fatal
(
"Ids do not match"
)
}
}
func
TestChannelPatch
(
t
*
testing
.
T
)
{
p
:=
&
ChannelPatch
{
Name
:
new
(
string
),
DisplayName
:
new
(
string
),
Header
:
new
(
string
),
Purpose
:
new
(
string
)}
*
p
.
Name
=
NewId
()
...
...
store/sql_channel_store.go
View file @
b0e367b1
...
...
@@ -405,7 +405,7 @@ func (s SqlChannelStore) get(id string, master bool, allowFromCache bool) StoreC
if
metrics
!=
nil
{
metrics
.
IncrementMemCacheHitCounter
(
"Channel"
)
}
result
.
Data
=
cacheItem
.
(
*
model
.
Channel
)
result
.
Data
=
(
cacheItem
.
(
*
model
.
Channel
))
.
DeepCopy
(
)
storeChannel
<-
result
close
(
storeChannel
)
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment