From 1100fcadd603444426fd67d67398cb7fedb05296 Mon Sep 17 00:00:00 2001 From: Cassandra Heart Date: Sat, 15 Feb 2025 03:33:14 -0600 Subject: [PATCH] switch to using unbuffered channel for queued requests --- node/rpc/hypergraph_sync_rpc_server.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/node/rpc/hypergraph_sync_rpc_server.go b/node/rpc/hypergraph_sync_rpc_server.go index b9bc278..ba11380 100644 --- a/node/rpc/hypergraph_sync_rpc_server.go +++ b/node/rpc/hypergraph_sync_rpc_server.go @@ -321,8 +321,10 @@ func syncTreeBidirectionallyServer( return err } - pendingQueries := make(chan []int32, 10000) - pendingQueries <- rootPath + pendingQueries := make(chan []int32) + go func(path []int32) { + pendingQueries <- path + }(rootPath) incoming := make(chan *protobufs.HypergraphComparison, 10000) go func() { @@ -458,7 +460,9 @@ func syncTreeBidirectionallyServer( append([]int32(nil), remoteInfo.Path...), remoteChild.Index, ) - pendingQueries <- newPath + go func(path []int32) { + pendingQueries <- path + }(newPath) } } } @@ -604,8 +608,10 @@ func SyncTreeBidirectionally( return err } - pendingQueries := make(chan []int32, 10000) - pendingQueries <- []int32{} + pendingQueries := make(chan []int32) + go func(path []int32) { + pendingQueries <- path + }([]int32{}) incoming := make(chan *protobufs.HypergraphComparison, 10000) go func() { @@ -730,7 +736,9 @@ func SyncTreeBidirectionally( append([]int32(nil), remoteInfo.Path...), remoteChild.Index, ) - pendingQueries <- newPath + go func(path []int32) { + pendingQueries <- path + }(newPath) } } }