diff --git a/stream/mts/meta/meta.go b/stream/mts/meta/meta.go index a0e6e3e3..466cb8e8 100644 --- a/stream/mts/meta/meta.go +++ b/stream/mts/meta/meta.go @@ -79,15 +79,15 @@ func New() *Metadata { // Add adds metadata with key and val. func (m *Metadata) Add(key, val string) { m.mu.Lock() + defer m.mu.Unlock() m.data[key] = val for _, k := range m.order { if k == key { - m.mu.Unlock() return } } m.order = append(m.order, key) - m.mu.Unlock() + return } // All returns the a copy of the map containing the meta data.