Skip to content

Commit

Permalink
Keep metastore locked during mark (#38)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored and michalkurzeja committed Jan 15, 2019
1 parent 26c332b commit 1cc1c48
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,23 +109,28 @@ func (s *metastore) Mark(p Processor, src Source, meta Metadata) error {
items, ok := (*procMeta)[p]
if !ok {
(*procMeta)[p] = Metaitems{{Source: src, Metadata: meta}}

s.procMu.Unlock()
return nil
}
s.procMu.Unlock()

if src == nil || meta == nil {
s.procMu.Unlock()
return nil
}

for _, item := range items {
if item.Source == src {
item.Metadata = meta.Merge(item.Metadata, Dupless)

s.procMu.Unlock()
return nil
}
}

items = append(items, &Metaitem{Source: src, Metadata: meta})
(*procMeta)[p] = items

s.procMu.Unlock()
return nil
}

0 comments on commit 1cc1c48

Please sign in to comment.