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

fix bug: adding back prefix in service group creation #1339

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

rexf
Copy link
Contributor

@rexf rexf commented Nov 5, 2024

fix bug: adding back prefix in service group creation

Currently, the prefix will be missing if we are creating group from group.
e.g.

let sg = service.group("level1");
sg.endpoint("endpoint1") ==> we can expect to see "level1.endpoint1"

let g2 = sg.group("level2:);
g2.endpoint("endpoint2") ==> now we will see "level2.endpoint2"

this patch is to fix and apply the prefix for the g2 endpoint such that the topic will become
level1.level2.endpoint2

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

Great catch!

Thanks!

Could you add a test for this case?

@@ -639,7 +639,7 @@ impl Group {
queue_group: Z,
) -> Group {
Group {
prefix: prefix.to_string(),
prefix: format!("{}.{}", self.prefix.to_string(), prefix.to_string()),
Copy link
Member

Choose a reason for hiding this comment

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

This does not need to_string() call.

Suggested change
prefix: format!("{}.{}", self.prefix.to_string(), prefix.to_string()),
prefix: format!("{}.{}", self.prefix, prefix.to_string()),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

@rexf
Copy link
Contributor Author

rexf commented Nov 12, 2024

Great catch!

Thanks!

Could you add a test for this case?

test case added.

@rexf rexf requested a review from Jarema November 12, 2024 15:48
@Jarema
Copy link
Member

Jarema commented Nov 13, 2024

Hm, I' not a fan of adding a test that starts a server in a unit test and we do not use this pattern across the client, but I can refactor it later myself based on your test, as you already did a lot.

Please fix fmt and it's good to merge.

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

Please fix fmt.

@rexf
Copy link
Contributor Author

rexf commented Nov 13, 2024

Thansk Jarema, cargo fmt applied.

@rexf rexf requested a review from Jarema November 13, 2024 08:30
Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

Thanks for your contribution!

@Jarema Jarema merged commit 79bf679 into nats-io:main Nov 13, 2024
12 checks passed
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