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

add concurrency for client's HostClient map #1550

Merged
merged 7 commits into from
May 11, 2023
Merged

add concurrency for client's HostClient map #1550

merged 7 commits into from
May 11, 2023

Conversation

xuxiao415
Copy link
Contributor

No description provided.

@erikdubbelboer
Copy link
Collaborator

What is the use case for this?

@xuxiao415
Copy link
Contributor Author

What is the use case for this?

I have a api gateway app. I just want to add concurrency for client's HostClient map. what's wrong with the code?

client.go Outdated
Comment on lines 314 to 322
// GetHostClients return the map of Http HostClient
func (c *Client) GetHostClients() map[string]*HostClient {
return c.m
}

// GetHttpsHostClients return the map of Https HostClient
func (c *Client) GetHttpsHostClients() map[string]*HostClient {
return c.ms
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why add these methods? Since m and ms are protected by mLock it's impossible to use the return value of these functions in a safe way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is test code. I will delete it

client.go Show resolved Hide resolved
@erikdubbelboer erikdubbelboer merged commit 7ea3b63 into valyala:master May 11, 2023
@erikdubbelboer
Copy link
Collaborator

Thanks!

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