Skip to content

fix: load cancelable + graph redudant - #27

Merged
massiveio merged 1 commit into
masterfrom
feature/develop
Sep 22, 2025
Merged

fix: load cancelable + graph redudant#27
massiveio merged 1 commit into
masterfrom
feature/develop

Conversation

@cloorc

@cloorc cloorc commented Sep 22, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

Signed-off-by: Cloorc <wittcnezh@foxmail.com>
Copilot AI review requested due to automatic review settings September 22, 2025 10:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses two issues: context management in the matcher and redundant graph relationship tracking in the dump functionality.

  • Changes context initialization from using the passed context to context.Background()
  • Updates graph relationship tracking from boolean map to any type map with explicit nil assignment

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
matcher.go Changes context initialization to use context.Background() instead of passed context
dump.go Updates graph relationship map from bool to any type and adds explicit nil assignment

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread matcher.go
nodeID: nodeID,
snapshotChanged: 0, // Initialize atomic flag to 1 (no changes)
ctx: ctx,
ctx: context.Background(),

Copilot AI Sep 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using context.Background() ignores the passed context parameter, which could break cancellation and timeout functionality. The original context should be used to maintain proper context propagation and cancellation behavior.

Suggested change
ctx: context.Background(),
ctx: ctx,

Copilot uses AI. Check for mistakes.
Comment thread dump.go
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), ""

Copilot AI Sep 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from map[string]bool to map[string]any with nil values is unnecessary and reduces type safety. The original boolean map approach was cleaner - the presence of a key in the map already indicates the relationship exists, making the value irrelevant.

Copilot uses AI. Check for mistakes.
Comment thread dump.go
for rid, next := range trans {
relationship = fmt.Sprintf("%s %s", current, next)
if _, ok := graphs[relationship]; !ok {
graphs[relationship] = nil

Copilot AI Sep 22, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from map[string]bool to map[string]any with nil values is unnecessary and reduces type safety. The original boolean map approach was cleaner - the presence of a key in the map already indicates the relationship exists, making the value irrelevant.

Copilot uses AI. Check for mistakes.
@massiveio
massiveio merged commit 17fe561 into master Sep 22, 2025
2 checks passed
@massiveio
massiveio deleted the feature/develop branch September 22, 2025 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants