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

Stop watchers before reconnecting to free their resources #14

Merged
merged 1 commit into from
Jun 26, 2017

Conversation

jsoriano
Copy link
Contributor

This change stop the watchers when reconnecting. If not, their channels and other resources are not freed, related to #13.

@jsoriano jsoriano added this to the next milestone Jun 15, 2017
@jsoriano jsoriano requested review from dpaneda and mrodm June 15, 2017 12:37
@@ -321,6 +339,7 @@ func (c *KubernetesClient) Watch() error {
}

if !more {
c.stopWatchers()
Copy link
Member

Choose a reason for hiding this comment

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

In this Watch function, should it be added a defer func() (as in connect function) to stop watchers too?

Copy link
Contributor Author

@jsoriano jsoriano Jun 19, 2017

Choose a reason for hiding this comment

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

Good point, probably the first call to something like the connect method should be made here in Watch (and not in the constructor) as at the end it the only stateful things it creates are the watchers.

I'll do another PR with some refactorizations about this.

Copy link
Member

Choose a reason for hiding this comment

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

👍

@jsoriano jsoriano merged commit 226200b into tuenti:master Jun 26, 2017
@jsoriano jsoriano deleted the memory-leak branch June 26, 2017 12:50
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