From 130b4a5eac016942cb5a1f26c7bd492388b20c7d Mon Sep 17 00:00:00 2001 From: goforbroke Date: Sun, 10 Jul 2022 01:28:53 +0300 Subject: [PATCH] #1651 fix pubsub chat example --- examples/pubsub/chat/ui.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/pubsub/chat/ui.go b/examples/pubsub/chat/ui.go index 165f67685e..51725bd1bb 100644 --- a/examples/pubsub/chat/ui.go +++ b/examples/pubsub/chat/ui.go @@ -121,10 +121,8 @@ func (ui *ChatUI) end() { func (ui *ChatUI) refreshPeers() { peers := ui.cr.ListPeers() - // clear is not threadsafe so we need to take the lock. - ui.peersList.Lock() + // clear is thread-safe ui.peersList.Clear() - ui.peersList.Unlock() for _, p := range peers { fmt.Fprintln(ui.peersList, shortID(p))