don't try looking up boxes concurrently
This commit is contained in:
parent
3d0cb6c737
commit
3dfe29724a
12
activity.go
12
activity.go
|
@ -273,6 +273,7 @@ type Box struct {
|
||||||
|
|
||||||
var boxofboxes = make(map[string]*Box)
|
var boxofboxes = make(map[string]*Box)
|
||||||
var boxlock sync.Mutex
|
var boxlock sync.Mutex
|
||||||
|
var boxinglock sync.Mutex
|
||||||
|
|
||||||
func getboxes(ident string) (*Box, error) {
|
func getboxes(ident string) (*Box, error) {
|
||||||
boxlock.Lock()
|
boxlock.Lock()
|
||||||
|
@ -281,6 +282,17 @@ func getboxes(ident string) (*Box, error) {
|
||||||
if ok {
|
if ok {
|
||||||
return b, nil
|
return b, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boxinglock.Lock()
|
||||||
|
defer boxinglock.Unlock()
|
||||||
|
|
||||||
|
boxlock.Lock()
|
||||||
|
b, ok = boxofboxes[ident]
|
||||||
|
boxlock.Unlock()
|
||||||
|
if ok {
|
||||||
|
return b, nil
|
||||||
|
}
|
||||||
|
|
||||||
j, err := GetJunk(ident)
|
j, err := GetJunk(ident)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in New Issue