From 59ba5131dcf59c7296afae197e402b1a5a3f1ccc Mon Sep 17 00:00:00 2001 From: Cloorc Date: Mon, 22 Sep 2025 01:17:09 +0100 Subject: [PATCH] fix: load cancelable + graph redudant Signed-off-by: Cloorc --- dump.go | 3 ++- matcher.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dump.go b/dump.go index 832edb2..193ac27 100644 --- a/dump.go +++ b/dump.go @@ -136,7 +136,7 @@ func DumpForestToFile(m *InMemoryMatcher, filename string) error { // Tenant header graphLines = append(graphLines, fmt.Sprintf("# Tenant: %s", tenantKey)) mappingLines = append(mappingLines, fmt.Sprintf("# Tenant: %s", tenantKey)) - graphs, relationship := make(map[string]bool), "" + graphs, relationship := make(map[string]any), "" // Snapshot NodeRelationships under forest lock forest.mu.RLock() @@ -145,6 +145,7 @@ func DumpForestToFile(m *InMemoryMatcher, filename string) error { for rid, next := range trans { relationship = fmt.Sprintf("%s %s", current, next) if _, ok := graphs[relationship]; !ok { + graphs[relationship] = nil graphLines = append(graphLines, relationship) } b.WriteString(rid) diff --git a/matcher.go b/matcher.go index 0dba1f3..bb153ed 100644 --- a/matcher.go +++ b/matcher.go @@ -70,7 +70,7 @@ func newInMemoryMatcherWithContext(ctx context.Context, cancel context.CancelFun eventsChan: make(chan *Event, 100), nodeID: nodeID, snapshotChanged: 0, // Initialize atomic flag to 1 (no changes) - ctx: ctx, + ctx: context.Background(), cancel: cancel, }