Skip to content

Commit

Permalink
Add hack for nil count
Browse files Browse the repository at this point in the history
  • Loading branch information
gfr10598 committed Dec 14, 2018
1 parent 08d6f66 commit 2983035
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ func (am *AnnotatorMap) maybeSetNil(key string) bool {
return false
}

nilCount := 0
for _, v := range am.annotators {
if v == nil {
nilCount++
if nilCount > 2 {
// TODO - enable this without breaking unit test
// return false // Too busy, wait for another time.
}
}
}

// Place marker so that other requesters know it is loading.
am.annotators[key] = nil
return true
Expand Down Expand Up @@ -186,6 +197,7 @@ func (am *AnnotatorMap) GetAnnotator(key string) (api.Annotator, error) {
// Another goroutine is already loading this entry. Return error.
return nil, ErrPendingAnnotatorLoad
}
log.Println("returning correct annotator")
return ann, nil
}

Expand Down

0 comments on commit 2983035

Please sign in to comment.