1
0
Fork 0
forked from forgejo/forgejo

move unlocking out of setInternal

This commit is contained in:
Andrew Thornton 2020-01-04 15:12:43 +00:00
parent e852cb620f
commit 21b9778119
No known key found for this signature in database
GPG key ID: 3CDE74631F13A748
2 changed files with 23 additions and 8 deletions

View file

@ -122,7 +122,12 @@ func (p *PersistableChannelQueue) Push(data Data) error {
func (p *PersistableChannelQueue) Run(atShutdown, atTerminate func(context.Context, func())) {
p.lock.Lock()
if p.internal == nil {
p.setInternal(atShutdown, p.ChannelQueue.pool.handle, p.exemplar)
err := p.setInternal(atShutdown, p.ChannelQueue.pool.handle, p.exemplar)
p.lock.Unlock()
if err != nil {
log.Fatal("Unable to create internal queue for %s Error: %v", p.Name(), err)
return
}
} else {
p.lock.Unlock()
}