Skip to content

Commit

Permalink
Grab the metadata after lock (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
nrwiersma authored Jan 15, 2019
1 parent 1cc1c48 commit 1432497
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions metastore.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ func (s *metastore) Mark(p Processor, src Source, meta Metadata) error {
return nil
}

procMeta := s.metadata.Load().(*map[Processor]Metaitems)

if meta != nil {
o := ProcessorOrigin
if _, ok := p.(Committer); ok {
Expand All @@ -104,8 +102,11 @@ func (s *metastore) Mark(p Processor, src Source, meta Metadata) error {

meta.WithOrigin(o)
}

s.procMu.Lock()

procMeta := s.metadata.Load().(*map[Processor]Metaitems)

items, ok := (*procMeta)[p]
if !ok {
(*procMeta)[p] = Metaitems{{Source: src, Metadata: meta}}
Expand Down

0 comments on commit 1432497

Please sign in to comment.