resolve memory issue with commit

This commit is contained in:
Cassandra Heart 2025-03-26 02:38:31 -05:00
parent 3cd7c2bb27
commit 1024bbada5
No known key found for this signature in database
GPG Key ID: 6352152859385958
2 changed files with 7 additions and 1 deletions

View File

@ -103,7 +103,11 @@ func (n *LazyVectorCommitmentBranchNode) Commit(
if n.Commitment == nil || recalculate {
vector := make([][]byte, len(n.Children))
wg := sync.WaitGroup{}
throttle := make(chan struct{}, runtime.WorkerCount(0, false))
workers := 1
if n.LongestBranch == 2 {
workers = runtime.WorkerCount(0, false)
}
throttle := make(chan struct{}, workers)
for i, child := range n.Children {
throttle <- struct{}{}
wg.Add(1)

View File

@ -67,6 +67,7 @@ func TestLoadHypergraphFallback(t *testing.T) {
}
for k, a := range clientLoad.GetVertexAdds() {
assert.Equal(t, len(crypto.ConvertAllPreloadedLeaves(string(application.VertexAtomType), string(application.AddsPhaseType), k, clientHypergraphStore, a.GetTree().Root, []int{})), 100000)
fmt.Printf("%x\n", a.GetTree().Commit(true))
}
fmt.Println("Should not reattempt")
@ -75,6 +76,7 @@ func TestLoadHypergraphFallback(t *testing.T) {
assert.NoError(t, err)
clientLoad, err = clientHypergraphStore.LoadHypergraph()
assert.NoError(t, err)
t.FailNow()
}
func TestHypergraphSyncServer(t *testing.T) {