From 638148afab0eda6eeacc70e3e644b8aa289e6777 Mon Sep 17 00:00:00 2001 From: Noah Metz Date: Sun, 2 Jul 2023 09:05:34 -0600 Subject: [PATCH] Updated FindChild to use UseMoreStates and expect to get passed currently held states --- gql_graph.go | 2 +- thread.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gql_graph.go b/gql_graph.go index 8ea403f..5d857b5 100644 --- a/gql_graph.go +++ b/gql_graph.go @@ -796,7 +796,7 @@ func GQLMutationSendUpdate() *graphql.Field { var node GraphNode = nil err := UseStates(ctx, []GraphNode{server}, func(states NodeStateMap) (error){ server_state := states[server.ID()].(*GQLThreadState) - node = FindChild(ctx, server, server_state, NodeID(id)) + node = FindChild(ctx, server, server_state, NodeID(id), states) if node == nil { return fmt.Errorf("Failed to find ID: %s as child of server thread", id) } diff --git a/thread.go b/thread.go index c5c2108..5759f4b 100644 --- a/thread.go +++ b/thread.go @@ -321,7 +321,7 @@ type Thread interface { ChildWaits() *sync.WaitGroup } -func FindChild(ctx * GraphContext, thread Thread, thread_state ThreadState, id NodeID) Thread { +func FindChild(ctx * GraphContext, thread Thread, thread_state ThreadState, id NodeID, states NodeStateMap) Thread { if thread == nil { panic("cannot recurse through nil") } @@ -332,9 +332,9 @@ func FindChild(ctx * GraphContext, thread Thread, thread_state ThreadState, id N for _, child := range thread_state.Children() { var result Thread = nil - UseStates(ctx, []GraphNode{child}, func(states NodeStateMap) (error) { + UseMoreStates(ctx, []GraphNode{child}, states, func(states NodeStateMap) (error) { child_state := states[child.ID()].(ThreadState) - result = FindChild(ctx, child, child_state, id) + result = FindChild(ctx, child, child_state, id, states) return nil }) if result != nil {