Skip to content

fix: missing kvs close (only that)#21

Open
brainiac-five wants to merge 1 commit intomasterfrom
fix/missing-kvs-close-2
Open

fix: missing kvs close (only that)#21
brainiac-five wants to merge 1 commit intomasterfrom
fix/missing-kvs-close-2

Conversation

@brainiac-five
Copy link
Collaborator

Adding the missing Close() function to KVS.

Fixes #18.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a missing Close() method to the SwarmKvs struct to properly clean up resources by closing the underlying index, addressing issue #18.

Changes:

  • Added Close() method to SwarmKvs that delegates to the underlying index's Close() method
  • Added test case to verify the Close() functionality works correctly

Reviewed changes

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

File Description
kvs.go Implements the Close() method for SwarmKvs to close the underlying index
kvs_test.go Adds test case that creates a KVS, writes data, saves it, and closes it

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


err = kvs1.Close()
assert.NoError(t, err)
})
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

There is trailing whitespace on this line. Remove it to maintain code consistency.

Suggested change
})
})

Copilot uses AI. Check for mistakes.
return nil
}

// Close stops the mutex
Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

The comment is inaccurate. According to the Index.Close() implementation, it closes the quit channel to stop the muxProcess goroutine, not a mutex. Consider updating the comment to better reflect what the function does, such as "Close stops the background process loop" or "Close shuts down the index".

Suggested change
// Close stops the mutex
// Close shuts down the index and stops the background process loop.

Copilot uses AI. Check for mistakes.
}
return nil
}

Copy link

Copilot AI Jan 17, 2026

Choose a reason for hiding this comment

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

There is trailing whitespace on this line. Remove it to maintain code consistency.

Suggested change

Copilot uses AI. Check for mistakes.
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.

KVS missing Close() method to release Index mutex

2 participants