Skip to content

Commit aeebe48

Browse files
committed
send discovery off into its own goroutine
License: MIT Signed-off-by: Jeromy <[email protected]>
1 parent 5a92036 commit aeebe48

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

core/commands/pubsub.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,16 @@ To use, the daemon must be run with '--enable-pubsub-experiment'.
105105

106106
discover, _, _ := req.Option("discover").Bool()
107107
if discover {
108-
blk := blocks.NewBlock([]byte("floodsub:" + topic))
109-
cid, err := n.Blocks.AddObject(blk)
110-
if err != nil {
111-
log.Error("pubsub discovery: ", err)
112-
return
113-
}
108+
go func() {
109+
blk := blocks.NewBlock([]byte("floodsub:" + topic))
110+
cid, err := n.Blocks.AddObject(blk)
111+
if err != nil {
112+
log.Error("pubsub discovery: ", err)
113+
return
114+
}
114115

115-
connectToPubSubPeers(req.Context(), n, cid)
116+
connectToPubSubPeers(req.Context(), n, cid)
117+
}()
116118
}
117119
},
118120
Marshalers: cmds.MarshalerMap{

0 commit comments

Comments
 (0)