From 01728ac758ad15c567401852113a327a6ead88b1 Mon Sep 17 00:00:00 2001 From: Anton Dort-Golts Date: Thu, 17 Dec 2020 18:43:43 +0300 Subject: [PATCH] Fix notifee deadlock on listener close Signed-off-by: Anton Dort-Golts --- db/listeners.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/db/listeners.go b/db/listeners.go index cba1b15c..0be1ddd6 100644 --- a/db/listeners.go +++ b/db/listeners.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/ipfs/go-ipld-format" + format "github.com/ipfs/go-ipld-format" "github.com/textileio/go-threads/core/app" core "github.com/textileio/go-threads/core/db" "github.com/textileio/go-threads/core/thread" @@ -107,8 +107,6 @@ func (scn *stateChangedNotifee) addListener(sl *listener) { } func (scn *stateChangedNotifee) remove(sl *listener) bool { - scn.lock.Lock() - defer scn.lock.Unlock() for i := range scn.listeners { if scn.listeners[i] == sl { scn.listeners[i] = scn.listeners[len(scn.listeners)-1]