all repos — honk @ fc18a40ac61b407d0749fbf6960993fa3334f587

my fork of honk

don't try looking up boxes concurrently
Ted Unangst tedu@tedunangst.com
Tue, 16 Apr 2019 20:20:42 -0400
commit

fc18a40ac61b407d0749fbf6960993fa3334f587

parent

17296460cb0345a842fdaae7ce0c913133ad88eb

1 files changed, 12 insertions(+), 0 deletions(-)

jump to
M activity.goactivity.go

@@ -273,6 +273,7 @@ }

var boxofboxes = make(map[string]*Box) var boxlock sync.Mutex +var boxinglock sync.Mutex func getboxes(ident string) (*Box, error) { boxlock.Lock()

@@ -281,6 +282,17 @@ boxlock.Unlock()

if ok { 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) if err != nil { return nil, err