From aeebe48c2ca33914ec101b2de8edbece6e3ba8db Mon Sep 17 00:00:00 2001 From: Jeromy Date: Thu, 15 Sep 2016 00:39:38 -0700 Subject: [PATCH] send discovery off into its own goroutine License: MIT Signed-off-by: Jeromy --- core/commands/pubsub.go | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/core/commands/pubsub.go b/core/commands/pubsub.go index 6f9dde58b..3df73939c 100644 --- a/core/commands/pubsub.go +++ b/core/commands/pubsub.go @@ -105,14 +105,16 @@ To use, the daemon must be run with '--enable-pubsub-experiment'. discover, _, _ := req.Option("discover").Bool() if discover { - blk := blocks.NewBlock([]byte("floodsub:" + topic)) - cid, err := n.Blocks.AddObject(blk) - if err != nil { - log.Error("pubsub discovery: ", err) - return - } + go func() { + blk := blocks.NewBlock([]byte("floodsub:" + topic)) + cid, err := n.Blocks.AddObject(blk) + if err != nil { + log.Error("pubsub discovery: ", err) + return + } - connectToPubSubPeers(req.Context(), n, cid) + connectToPubSubPeers(req.Context(), n, cid) + }() } }, Marshalers: cmds.MarshalerMap{