mirror of https://bitbucket.org/ausocean/av.git
stream/mts/meta.go: avoiding adding same key to order slice
This commit is contained in:
parent
834625a9f7
commit
3364b4ea6f
|
@ -80,6 +80,12 @@ func New() *Metadata {
|
||||||
func (m *Metadata) Add(key, val string) {
|
func (m *Metadata) Add(key, val string) {
|
||||||
m.mu.Lock()
|
m.mu.Lock()
|
||||||
m.data[key] = val
|
m.data[key] = val
|
||||||
|
for _, k := range m.order {
|
||||||
|
if k == key {
|
||||||
|
m.mu.Unlock()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
m.order = append(m.order, key)
|
m.order = append(m.order, key)
|
||||||
m.mu.Unlock()
|
m.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue