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

controlplane/peer/client: Issue requests in parallel #523

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

orozery
Copy link
Collaborator

@orozery orozery commented Apr 15, 2024

This PR changes the client to issue requests in parallel for peers who have multiple gateways.

@orozery orozery force-pushed the peer-multiple-gateways branch from bd467d8 to 78ad44c Compare April 15, 2024 11:16
func (c *Client) getResponse(
getRespFunc func(client *jsonapi.Client) (*jsonapi.Response, error),
) (*jsonapi.Response, error) {
if len(c.clients) == 1 {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need this case and can't do iteration on 1 client?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the common case, and the purpose is to make it more simple since you don't need go-routines and the multi-threaded syncing in this case.

body, err := json.Marshal(req)
if err != nil {
return nil, fmt.Errorf("unable to serialize authorization request: %w", err)
func (c *Client) getResponse(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you write a comment for the function, what it returns in case of multiple gateways (in the function description or near the code)

This commit changes the client to issue requests in parallel
for peers who have multiple gateways.

Signed-off-by: Or Ozeri <oro@il.ibm.com>
@orozery orozery force-pushed the peer-multiple-gateways branch from 78ad44c to 0c1d041 Compare April 16, 2024 07:09
@orozery orozery merged commit fe49f2a into clusterlink-net:main Apr 16, 2024
9 checks passed
@orozery orozery deleted the peer-multiple-gateways branch May 28, 2024 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants