Skip to content

Commit

Permalink
fix deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
serejja committed Mar 23, 2016
1 parent 830794d commit dfcc855
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion schema_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,14 @@ func (this *CachedSchemaRegistryClient) Register(subject string, schema avro.Sch

this.lock.RLock()
if schemaIdMap, exists = this.schemaCache[subject]; exists {
this.lock.RUnlock()
var id int32
if id, exists = schemaIdMap[schema]; exists {
return id, nil
}
} else {
this.lock.RUnlock()
}
this.lock.RUnlock()

this.lock.Lock()
defer this.lock.Unlock()
Expand Down

0 comments on commit dfcc855

Please sign in to comment.