Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Cluster Size Calculation Logic into Separate Function #1636

Conversation

stav-bentov
Copy link
Contributor

Refactored the cluster size calculation logic into a dedicated function, clusterDetermineClusterSize, to enhance code organization and readability.

Copy link

codecov bot commented Jan 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.00%. Comparing base (9071a5c) to head (b5a08a4).
Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1636      +/-   ##
============================================
+ Coverage     70.85%   71.00%   +0.15%     
============================================
  Files           121      121              
  Lines         65169    65179      +10     
============================================
+ Hits          46176    46283     +107     
+ Misses        18993    18896      -97     
Files with missing lines Coverage Δ
src/cluster_legacy.c 87.25% <100.00%> (+0.04%) ⬆️

... and 17 files with indirect coverage changes

Copy link
Member

@madolson madolson left a comment

Choose a reason for hiding this comment

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

I would vote not to accept this change. I don't think it materially improves the code quality.

@@ -5546,6 +5546,31 @@ void clusterCloseAllSlots(void) {
memset(server.cluster->importing_slots_from, 0, sizeof(server.cluster->importing_slots_from));
}

static void clusterDetermineClusterSize(int *reachable_primaries) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
static void clusterDetermineClusterSize(int *reachable_primaries) {
static int clusterDetermineClusterSize(void) {

Then return the size at the end.

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.

2 participants